/********************************************************************************/
/*   The  Software  is  proprietary,  confidential,  and  valuable to Realtek   */
/*   Semiconductor  Corporation  ("Realtek").  All  rights, including but not   */
/*   limited  to  copyrights,  patents,  trademarks, trade secrets, mask work   */
/*   rights, and other similar rights and interests, are reserved to Realtek.   */
/*   Without  prior  written  consent  from  Realtek,  copying, reproduction,   */
/*   modification,  distribution,  or  otherwise  is strictly prohibited. The   */
/*   Software  shall  be  kept  strictly  in  confidence,  and  shall  not be   */
/*   disclosed to or otherwise accessed by any third party.                     */
/*   c<2003> - <2012>                                                           */
/*   The Software is provided "AS IS" without any warranty of any kind,         */
/*   express, implied, statutory or otherwise.                                  */
/********************************************************************************/

//----------------------------------------------------------------------------------------------------
// ID Code      : RL6369_Series_QC_Color.c No.0000
// Update Note  :
//----------------------------------------------------------------------------------------------------

#define __RL6369_SERIES_QC_COLOR_IMDOMAIN__

#include "ScalerFunctionInclude.h"

#if(_FACTORY_RTD_QC_SUPPORT == _ON)

//****************************************************************************
// DEFINITIONS / MACROS
//****************************************************************************


//****************************************************************************
// STRUCT / TYPE / ENUM DEFINITTIONS
//****************************************************************************


//****************************************************************************
// CODE TABLES
//****************************************************************************
//--------------------------------------------------
// Code Tables of VGA PG CRC
//--------------------------------------------------
BYTE code tVGAPG_CRC_TABLE0[] =
{
    0xF9, 0x94, 0x8F, 0x2F, 0xCE, 0x61,
};

BYTE code tVGAPG_CRC_TABLE1[] =
{
    0x8D, 0xB1, 0x8A, 0xBF, 0x87, 0xE5,
};

//--------------------------------------------------
// Code Tables of ADCNR
//--------------------------------------------------
BYTE code tADCNR_CRC_TABLE0[] = {
    0x92, 0x40, 0xFD, 0x00, 0x00, 0x00,
};

//--------------------------------------------------
// Code Tables of RingingFilter CRC
//--------------------------------------------------
BYTE code tRingingFilterTest0_ICRCTable[] = {
    0x9F, 0x45, 0x2C, 0xBF, 0x87, 0xE5,
};
BYTE code tRingingFilterTest1_ICRCTable[] = {
    0xA5, 0xEB, 0x74, 0xBF, 0x87, 0xE5,
};
BYTE code tRingingFilterTest2_ICRCTable[] = {
    0x94, 0x1F, 0x67, 0xBF, 0x87, 0xE5,
};
BYTE code tRingingFilterTest3_ICRCTable[] = {
    0xEC, 0x94, 0xB4, 0xBF, 0x87, 0xE5,
};
BYTE code tRingingFilterTest4_ICRCTable[] = {
    0x27, 0x38, 0x07, 0xBF, 0x87, 0xE5,
};
BYTE code tRingingFilterTest5_ICRCTable[] = {
    0x7E, 0xE6, 0x80, 0xBF, 0x87, 0xE5,
};
BYTE code tRingingFilterTest6_ICRCTable[] = {
    0x20, 0x32, 0x60, 0xBF, 0x87, 0xE5,
};
BYTE code tRingingFilterTest7_ICRCTable[] = {
    0xD2, 0x4D, 0x19, 0xBF, 0x87, 0xE5,
};

//--------------------------------------------------
// Code Tables of DigitalFilter CRC
//--------------------------------------------------
BYTE code tDigitalFilterTest0_ICRCTable[] = {
    0x05, 0x0F, 0xC4, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest1_ICRCTable[] = {
    0xD0, 0xB5, 0xDA, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest2_ICRCTable[] = {
    0x41, 0xD1, 0x9B, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest3_ICRCTable[] = {
    0xF6, 0x03, 0xB4, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest4_ICRCTable[] = {
    0xFA, 0xB7, 0xCF, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest5_ICRCTable[] = {
    0xFA, 0xB7, 0xCF, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest6_ICRCTable[] = {
    0xFA, 0xB7, 0xCF, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest7_ICRCTable[] = {
    0x13, 0xA1, 0x20, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest8_ICRCTable[] = {
    0x03, 0x48, 0xE8, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest9_ICRCTable[] = {
    0x13, 0x6C, 0xFC, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest10_ICRCTable[] = {
    0x1D, 0x07, 0x3D, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest11_ICRCTable[] = {
    0x64, 0xEC, 0xF9, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest12_ICRCTable[] = {
    0xA4, 0x51, 0x26, 0xBF, 0x87, 0xE5,
};
BYTE code tDigitalFilterTest13_ICRCTable[] = {
    0x64, 0x21, 0x25, 0xBF, 0x87, 0xE5,
};

//--------------------------------------------------
// Code Tables of I Domain 422to444 CRC
//--------------------------------------------------
BYTE code t422to444_Table0[] = {
    0x87, 0x04, 0x05, 0x22, 0x8F, 0xE8,
};

BYTE code t422to444_Table1[] = {
    0xA7, 0xF0, 0x47, 0x00, 0x64, 0x48,
};

BYTE code t422to444_Table2[] = {
    0x52, 0x2D, 0x60, 0x24, 0x00, 0x56,
};

//--------------------------------------------------
// Code Tables of Color Conversion
//--------------------------------------------------
// RGB to YCC Table
BYTE code tQC_CONV_RGB2YUV_TABLE0[] =
{
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x9C, 0x08,
    21, _NON_AUTOINC, 0x9D, 0x00, 0xBB, 0x02, 0x75, 0x00, 0x3F, 0xFF, 0x99, 0xFE, 0xA6, 0x01, 0xC1, 0x01, 0xC1, 0xFE, 0x68, 0xFF, 0xD7,
    4, _NON_AUTOINC, 0x9C, 0xC1,

    _END
};

BYTE code tQC_CONV_RGB2YUV_TABLE1[] =
{
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x9C, 0x08,
    21, _NON_AUTOINC, 0x9D, 0x12, 0x34, 0xFF, 0xFF, 0x55, 0x55, 0xAA, 0xAA, 0x00, 0x00, 0x84, 0x21, 0xAB, 0xCD, 0x24, 0x68, 0x39, 0x25,
    4, _NON_AUTOINC, 0x9C, 0x23,

    _END
};

BYTE code tQC_CONV_RGB2YUV_TABLE2[] =
{
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x9C, 0x08,
    21, _NON_AUTOINC, 0x9D, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
    4, _NON_AUTOINC, 0x9C, 0x01,

    _END
};

BYTE code tQC_CONV_RGB2YUV_TABLE3[] =
{
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x9C, 0x08,
    21, _NON_AUTOINC, 0x9D, 0xFF, 0xFF, 0x66, 0x66, 0x54, 0x32, 0x78, 0x64, 0x88, 0x88, 0x00, 0x00, 0xF0, 0x00, 0xAA, 0xAA, 0xA8, 0x45,
    4, _NON_AUTOINC, 0x9C, 0xA5,

    _END
};

BYTE code tQC_CONV_RGB2YUV_TABLE4[] =
{
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x9C, 0x08,
    21, _NON_AUTOINC, 0x9D, 0x00, 0x00, 0xAB, 0xCD, 0x65, 0x43, 0xFF, 0xFF, 0xAB, 0xCD, 0x65, 0x43, 0xFF, 0xFF, 0xAB, 0xCD, 0x65, 0x43,
    4, _NON_AUTOINC, 0x9C, 0x07,

    _END
};

BYTE code tQC_CONV_RGB2YUV_TABLE5[] =
{
    4, _NON_AUTOINC, 0x9C, 0x08,
    21, _NON_AUTOINC, 0x9D, 0x00, 0xBB, 0x02, 0x75, 0x00, 0x3F, 0xFF, 0x99, 0xFE, 0xA6, 0x01, 0xC1, 0x01, 0xC1, 0xFE, 0x68, 0xFF, 0xD7,
    4, _NON_AUTOINC, 0x9C, 0xC1,

    _END
};


// -----------CRC Table of Color Conversion------------
BYTE code tICOLORCONV_CRC_TABLE0[] = {
    0x1A, 0x6F, 0xBA, 0x1B, 0x5F, 0x24,
};

BYTE code tICOLORCONV_CRC_TABLE1[] = {
    0x15, 0x33, 0x92, 0x19, 0x53, 0xC4,
};

BYTE code tICOLORCONV_CRC_TABLE2[] = {
    0x8D, 0xB1, 0x8A, 0xBF, 0x87, 0xE5,
};

BYTE code tICOLORCONV_CRC_TABLE3[] = {
    0x90, 0x5E, 0x68, 0x30, 0x65, 0xF0,
};

BYTE code tICOLORCONV_CRC_TABLE4[] = {
    0xFD, 0xFA, 0x80, 0xC9, 0xDD, 0xBC,
};


//--------------------------------------------------
// Code Tables of IPG CRC
//--------------------------------------------------
BYTE code tIPG_CRC_TABLE[] =
{
    0xF9, 0x94, 0x8F, 0x2F, 0xCE, 0x61,
};

BYTE code tIPG_CRC_TABLE1[] =
{
    0x8D, 0xB1, 0x8A, 0xBF, 0x87, 0xE5,
};

//--------------------------------------------------
// Description  : I Domain Dither Table 10 -> 8 Setting
// Input Value  : None
// Output Value : None
//--------------------------------------------------
BYTE code tQC_I_DOMAIN_DITHER_12_10_TABLE[] =
{
    // 12 --> 10
    0x01, 0x32, 0x12, 0x03, 0x23, 0x10, 0x30, 0x21,
    0x23, 0x10, 0x30, 0x21, 0x01, 0x32, 0x12, 0x03,
    0x30, 0x21, 0x01, 0x32, 0x12, 0x03, 0x23, 0x10,
};

//--------------------------------------------------
// Description  : I Domain Dither Table 10 -> 6 Setting
//--------------------------------------------------
BYTE code tQC_I_DOMAIN_DITHER_12_8_TABLE[] =
{
    // 12 --> 8
    0x07, 0xF8, 0x69, 0x1E, 0xAD, 0x52, 0xC3, 0xB4,
    0xAD, 0x52, 0xC3, 0xB4, 0x07, 0xF8, 0x69, 0x1E,
    0xAD, 0x52, 0x69, 0x1E, 0xC3, 0xB4, 0x07, 0xF8,
};

//--------------------------------------------------
// Description  : I Domain Dither Sequence Table Setting
//--------------------------------------------------
BYTE code tQC_I_DOMAIN_DITHER_SEQ_TABLE[] =
{
    0xE4, 0xA2, 0x05, 0x37, 0xF6, 0x31, 0x69, 0xCB, 0x1F, 0xD2, 0xB0, 0xE6,
    0x45, 0x1B, 0x87, 0xC6, 0x9E, 0xB4, 0xC6, 0x38, 0xD4, 0xDB, 0x12, 0x1B,
};

//--------------------------------------------------
// Description  : I Dither Offset Table Setting
//--------------------------------------------------
BYTE code tQC_I_DOMAIN_DITHER_TEMOFFSET[] =
{
    0xE4, 0xE4, 0xE4, 0xE4,
};

//--------------------------------------------------
// Description  : I Dither Pattern 0 Result
//--------------------------------------------------
BYTE code tQC_IDITHER_CRCTable_P0[] =
{
    0xEF, 0x87, 0x43, 0x84, 0xB8, 0x51,
    0x87, 0x2A, 0x74, 0x39, 0xD4, 0xA1,
    0x1C, 0x71, 0x05, 0x1A, 0x1A, 0xD9,
    0xF7, 0xD5, 0xDA, 0x79, 0x0B, 0xB8,
    0xEF, 0x87, 0x43, 0x84, 0xB8, 0x51,
};

BYTE code tQC_IDITHER_CRCTable_P1[] =
{
    0xD7, 0xCB, 0xDB, 0xF8, 0x90, 0xDC,
};

//--------------------------------------------------
// Code Tables of ScaleDown Coef
//--------------------------------------------------
BYTE code tQC_HSD_COEF[] =
{
    0xFB, 0x0F, 0xFE, 0x0F, 0xFD, 0x0F, 0xFC, 0x0F, 0xFB, 0x0F, 0xFA, 0x0F, 0xF7, 0x0F, 0xF5, 0x0F,
    0xF1, 0x0F, 0xED, 0x0F, 0xE9, 0x0F, 0xE4, 0x0F, 0xDE, 0x0F, 0xD9, 0x0F, 0xD3, 0x0F, 0xCD, 0x0F,
    0xC7, 0x0F, 0xDB, 0x0F, 0xF0, 0x0F, 0x0C, 0x00, 0x27, 0x00, 0x49, 0x00, 0x6B, 0x00, 0x93, 0x00,
    0xBC, 0x00, 0xEA, 0x00, 0x16, 0x01, 0x49, 0x01, 0x7A, 0x01, 0xB0, 0x01, 0xE3, 0x01, 0x1C, 0x02,
    0x84, 0x04, 0x78, 0x04, 0x6C, 0x04, 0x57, 0x04, 0x42, 0x04, 0x23, 0x04, 0x04, 0x04, 0xDC, 0x03,
    0xB4, 0x03, 0x86, 0x03, 0x59, 0x03, 0x26, 0x03, 0xF4, 0x02, 0xBD, 0x02, 0x89, 0x02, 0x50, 0x02,
    0xBA, 0x0F, 0xAF, 0x0F, 0xA7, 0x0F, 0xA1, 0x0F, 0x9C, 0x0F, 0x9A, 0x0F, 0x9A, 0x0F, 0x9C, 0x0F,
    0x9F, 0x0F, 0xA3, 0x0F, 0xA8, 0x0F, 0xAD, 0x0F, 0xB4, 0x0F, 0xBA, 0x0F, 0xC1, 0x0F, 0xC7, 0x0F,
};
BYTE code tQC_VSD_COEF[] =
{
    0x82, 0x0F, 0x97, 0x0F, 0xA4, 0x0F, 0xCE, 0x0F, 0xE8, 0x0F, 0x1A, 0x00, 0x3B, 0x00, 0x73, 0x00,
    0x98, 0x00, 0xD2, 0x00, 0xF8, 0x00, 0x32, 0x01, 0x58, 0x01, 0x91, 0x01, 0xB5, 0x01, 0xEE, 0x01,
    0x7E, 0x04, 0x69, 0x04, 0x5C, 0x04, 0x32, 0x04, 0x18, 0x04, 0xE6, 0x03, 0xC5, 0x03, 0x8D, 0x03,
    0x68, 0x03, 0x2E, 0x03, 0x08, 0x03, 0xCE, 0x02, 0xA8, 0x02, 0x6F, 0x02, 0x4B, 0x02, 0x12, 0x02,
};

//--------------------------------------------------
// Code Tables of ScaleDown CRC
//--------------------------------------------------
BYTE code tScaleDownTest0_ICRCTable[] = {
    0xE0, 0xB7, 0xB3, 0xB8, 0xB7, 0x08,
};

BYTE code tScaleDownTest1_ICRCTable[] = {
    0x9C, 0xE2, 0xD4, 0xE3, 0xFA, 0xB7,
};

BYTE code tQC_CON_BRI_HLW_SETTING[] =
{
    0x80, 0x80, 0x80, 0x77, 0x78, 0x79, 0x80, 0x80, 0x80, 0x81, 0x82, 0x83,
};

//--------------------------------------------------
// Code Tables of HLW CRC
//--------------------------------------------------
BYTE code tHLWTest0_DCRCTable[] =
{
    0xBD, 0x42, 0x18, 0x2C, 0xAE, 0xBE,
};

BYTE code tHLWTest1_DCRCTable[] =
{
    0xEA, 0x0F, 0xB3, 0x0E, 0x97, 0xEF,
};

BYTE code tHLWTest2_DCRCTable[] =
{
    0xDB, 0x03, 0xB0, 0xB8, 0xEC, 0x17,
};

BYTE code tHLWTest3_DCRCTable[] =
{
    0x77, 0x49, 0x39, 0xF9, 0x13, 0x40,
};

BYTE code tHLWTest4_DCRCTable[] =
{
    0xC9, 0x35, 0x99, 0x4E, 0xB1, 0x43,
};

//--------------------------------------------------
// Code Tables of HLW
//--------------------------------------------------
BYTE code tQC_HIGHLIGHT_WINDOW_SETTING[] =
{
    0x00,0x55,0x02,0xAA,0x00,0x55,0x02,0xAA,0x0F,0x3F,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,
};

//--------------------------------------------------
// Code Tables of ScaleUp CRC
//--------------------------------------------------
BYTE code tQC_SU_COEF[] =
{
    0xFB, 0x0F, 0xFE, 0x0F, 0xFD, 0x0F, 0xFC, 0x0F, 0xFB, 0x0F, 0xFA, 0x0F, 0xF7, 0x0F, 0xF5, 0x0F,
    0xF1, 0x0F, 0xED, 0x0F, 0xE9, 0x0F, 0xE4, 0x0F, 0xDE, 0x0F, 0xD9, 0x0F, 0xD3, 0x0F, 0xCD, 0x0F,
    0xC7, 0x0F, 0xDB, 0x0F, 0xF0, 0x0F, 0x0C, 0x00, 0x27, 0x00, 0x49, 0x00, 0x6B, 0x00, 0x93, 0x00,
    0xBC, 0x00, 0xEA, 0x00, 0x16, 0x01, 0x49, 0x01, 0x7A, 0x01, 0xB0, 0x01, 0xE3, 0x01, 0x1C, 0x02,
    0x84, 0x04, 0x78, 0x04, 0x6C, 0x04, 0x57, 0x04, 0x42, 0x04, 0x23, 0x04, 0x04, 0x04, 0xDC, 0x03,
    0xB4, 0x03, 0x86, 0x03, 0x59, 0x03, 0x26, 0x03, 0xF4, 0x02, 0xBD, 0x02, 0x89, 0x02, 0x50, 0x02,
    0xBA, 0x0F, 0xAF, 0x0F, 0xA7, 0x0F, 0xA1, 0x0F, 0x9C, 0x0F, 0x9A, 0x0F, 0x9A, 0x0F, 0x9C, 0x0F,
    0x9F, 0x0F, 0xA3, 0x0F, 0xA8, 0x0F, 0xAD, 0x0F, 0xB4, 0x0F, 0xBA, 0x0F, 0xC1, 0x0F, 0xC7, 0x0F,
};

BYTE code tMDomain_Table[] =
{
    0x8D, 0xB1, 0x8A, 0x00, 0x00, 0x00,
};

BYTE code tScaleUpTest0_DCRCTable[] =
{
    0x4F, 0xD4, 0x8A, 0x0D, 0x75, 0xCB,
};

BYTE code tScaleUpTest1_DCRCTable[] =
{
    0x23, 0xBB, 0xCD, 0xB6, 0x71, 0x7D,
};

BYTE code tScaleUpTest2_DCRCTable[] =
{
    0xAC, 0x57, 0xA3, 0x00, 0x00, 0x00,
};

//--------------------------------------------------
// Code Tables of M Domain LSR Setting
//--------------------------------------------------
BYTE code tQC_LSR_SETTING[] =
{
    4,  _AUTOINC,       0x9F,   0x14,
    29, _AUTOINC,       0xC0,   0xE0,0x28,0x1B,0x01,0x00,0xEF,0x00,0xD4,0x32,0x23,0x08,0x05,0x00,0x50,0x1E,0x8C,
                                0x14,0x32,0x0F,0x0A,0x0C,0x28,0x00,0x50,0x00,0x28,
    35, _AUTOINC,       0xE0,   0x00,0xE8,0x00,0xC8,0x29,0x14,0x08,0x05,0x00,0xA8,0x1E,0x96,0x1E,0x3C,0x0F,0x04,
                                0x0C,0x54,0x00,0xA8,0x00,0x54,0x00,0x48,0x04,0x48,0x80,0x80,0x00,0x40,0x0C,0x48,
    9,  _AUTOINC,       0x00,   0x04,0x84,0xCC,0xCC,0x44,0x84,
    13, _AUTOINC,       0x10,   0x2D,0x40,0x07,0x2D,0x40,0x06,0x00,0x0A,0x00,0x0A,
};
BYTE code tQC_LSR_HLW[] =
{
    4,  _AUTOINC,       0x9F,   0x11,
    11, _AUTOINC,       0xCC,   0x01,0x2C,0x03,0x84,0x01,0xF4,0x03,0xE8,
};

BYTE code tLSR_Table0[] =
{
    0xBA, 0xD3, 0xD3, 0x4D, 0xE4, 0x7A,
};

BYTE code tLSR_Table1[] =
{
    0x1B, 0xE4, 0x7E, 0x6A, 0x72, 0x62,
};

BYTE code tLSR_Table2[] =
{
    0x0D, 0x60, 0x0E, 0x27, 0x96, 0x18,
};

//--------------------------------------------------
// Code Tables of ScaleUp Coef
//--------------------------------------------------
BYTE code tQC_SU_COEF0[] =
{
    0xE0, 0x0F, 0xE9, 0x0F, 0xE8, 0x0F, 0xE9, 0x0F, 0xE8, 0x0F, 0xE7, 0x0F, 0xE4, 0x0F, 0xE3, 0x0F,
    0xE1, 0x0F, 0xDF, 0x0F, 0xDC, 0x0F, 0xDB, 0x0F, 0xD8, 0x0F, 0xD7, 0x0F, 0xD5, 0x0F, 0xD5, 0x0F,
    0x4C, 0x00, 0x61, 0x00, 0x78, 0x00, 0x92, 0x00, 0xAC, 0x00, 0xC9, 0x00, 0xE6, 0x00, 0x06, 0x01,
    0x26, 0x01, 0x48, 0x01, 0x69, 0x01, 0x8D, 0x01, 0xAF, 0x01, 0xD4, 0x01, 0xF6, 0x01, 0x1B, 0x02,
    0x9A, 0x03, 0x8B, 0x03, 0x84, 0x03, 0x75, 0x03, 0x68, 0x03, 0x56, 0x03, 0x44, 0x03, 0x2D, 0x03,
    0x15, 0x03, 0xFA, 0x02, 0xE0, 0x02, 0xC0, 0x02, 0xA3, 0x02, 0x81, 0x02, 0x61, 0x02, 0x3C, 0x02,
    0x3A, 0x00, 0x2B, 0x00, 0x1C, 0x00, 0x10, 0x00, 0x04, 0x00, 0xFA, 0x0F, 0xF2, 0x0F, 0xEA, 0x0F,
    0xE4, 0x0F, 0xDF, 0x0F, 0xDB, 0x0F, 0xD8, 0x0F, 0xD6, 0x0F, 0xD4, 0x0F, 0xD4, 0x0F, 0xD4, 0x0F,
};

BYTE code tQC_SU_COEF1[] =
{
    0xFB, 0x0F, 0xFE, 0x0F, 0xFD, 0x0F, 0xFC, 0x0F, 0xFB, 0x0F, 0xFA, 0x0F, 0xF7, 0x0F, 0xF5, 0x0F,
    0xF1, 0x0F, 0xED, 0x0F, 0xE9, 0x0F, 0xE4, 0x0F, 0xDE, 0x0F, 0xD9, 0x0F, 0xD3, 0x0F, 0xCD, 0x0F,
    0xC7, 0x0F, 0xDB, 0x0F, 0xF0, 0x0F, 0x0C, 0x00, 0x27, 0x00, 0x49, 0x00, 0x6B, 0x00, 0x93, 0x00,
    0xBC, 0x00, 0xEA, 0x00, 0x16, 0x01, 0x49, 0x01, 0x7A, 0x01, 0xB0, 0x01, 0xE3, 0x01, 0x1C, 0x02,
    0x84, 0x04, 0x78, 0x04, 0x6C, 0x04, 0x57, 0x04, 0x42, 0x04, 0x23, 0x04, 0x04, 0x04, 0xDC, 0x03,
    0xB4, 0x03, 0x86, 0x03, 0x59, 0x03, 0x26, 0x03, 0xF4, 0x02, 0xBD, 0x02, 0x89, 0x02, 0x50, 0x02,
    0xBA, 0x0F, 0xAF, 0x0F, 0xA7, 0x0F, 0xA1, 0x0F, 0x9C, 0x0F, 0x9A, 0x0F, 0x9A, 0x0F, 0x9C, 0x0F,
    0x9F, 0x0F, 0xA3, 0x0F, 0xA8, 0x0F, 0xAD, 0x0F, 0xB4, 0x0F, 0xBA, 0x0F, 0xC1, 0x0F, 0xC7, 0x0F,
};

//--------------------------------------------------
// Code Tables of DPG CRC
//--------------------------------------------------
BYTE code tDPG_CRC_TABLE[] =
{
    0xD2, 0x5A, 0x4A, 0xFA, 0x84, 0x59,
};

BYTE code tDPG_RANDOM_CRC_TABLE[] =
{
    0xB8, 0x2F, 0xBB, 0xB9, 0xD5, 0x3B,
};

BYTE code tDPG_RANDOM_CRC_TABLE1[] =
{
    0x41, 0xF9, 0x6D, 0xBD, 0xA0, 0x9C,
};

//--------------------------------------------------
// Code Tables of PCM
//--------------------------------------------------
BYTE code tPCM_TEST_SETA[] =
{
    //---------inputgamma-------------
    4, _NON_AUTOINC, 0x9F, 0x09,
    4, _NON_AUTOINC, 0xA1, 0x80,
    102, _NON_AUTOINC, 0xA0, 0x00, 0x00, 0x14, 0x02, 0x80, 0x3C, 0x05, 0x50, 0x72, 0x09, 0x50, 0xBE, 0x0E, 0xC1, 0x20, 0x15, 0xA1, 0x9B, 0x1E, 0x22, 0x30, 0x28, 0x52, 0xE1, 0x34, 0x53, 0xAF, 0x10, 0x81, 0x27, 0x14, 0x71, 0x6A, 0x18, 0xE1, 0xB5, 0x1D, 0xD2, 0x08, 0x23, 0x52, 0x64, 0x29, 0x52, 0xC8, 0x2F, 0xE3, 0x36, 0x37, 0x13, 0xAE, 0x3E, 0xC1, 0x0C, 0x11, 0xC1, 0x2E, 0x14, 0x01, 0x53, 0x16, 0x71, 0x7B, 0x18, 0xF1, 0xA5, 0x1B, 0xB1, 0xD2, 0x1E, 0x92, 0x01, 0x21, 0xA2, 0x33, 0x24, 0xD2, 0x68, 0x28, 0x32, 0xA0, 0x2B, 0xC2, 0xDA, 0x2F, 0x83, 0x17, 0x33, 0x73, 0x58, 0x37, 0x93, 0x9B, 0x3B, 0xD3, 0xE1, 0x3F, 0xC0, 0x00,
    4, _NON_AUTOINC, 0xA1, 0x40,

    4, _NON_AUTOINC, 0xA2, 0x11,
    4, _NON_AUTOINC, 0xA3, 0x22,
    //---------srgb-------------
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x62, 0x44,
    27, _NON_AUTOINC, 0x63, 0x01, 0xAA, 0x00, 0x14, 0x00, 0x02, 0x00, 0x0A, 0x01, 0xA6, 0x00, 0x09, 0x00, 0x06, 0x00, 0x0B, 0x01, 0xEE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    4, _NON_AUTOINC, 0x62, 0x84,

    //---------outputgamma-------------
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x67, 0x84,
    27, _NON_AUTOINC, 0x66, 0x00, 0x40, 0x09, 0x00, 0xE0, 0x13, 0x01, 0x80, 0x00, 0x02, 0xA0, 0x23, 0x00, 0x00, 0x30, 0x04, 0x10, 0x4E, 0x05, 0x80, 0x61, 0x06, 0xA0, 0x72,

    4, _NON_AUTOINC, 0x67, 0x94,
    27, _NON_AUTOINC, 0x66, 0x00, 0x40, 0x0B, 0x01, 0x20, 0x18, 0x01, 0xF0, 0x00, 0x03, 0x00, 0x29, 0x00, 0x00, 0x36, 0x04, 0x80, 0x56, 0x06, 0x10, 0x6B, 0x07, 0x30, 0x7B,

    4, _NON_AUTOINC, 0x67, 0xA4,
    27, _NON_AUTOINC, 0x66, 0x00, 0x40, 0x0B, 0x01, 0x30, 0x1A, 0x02, 0x10, 0x00, 0x03, 0x70, 0x2E, 0x00, 0x00, 0x3D, 0x04, 0xE0, 0x5B, 0x06, 0x70, 0x73, 0x07, 0xC0, 0x84,

    4, _NON_AUTOINC, 0x67, 0x80,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x07, 0x90, 0x92, 0x0A, 0x60, 0xB7, 0x0C, 0x50, 0xD2, 0x0D, 0xD0, 0xE8, 0x0F, 0x00, 0xFA, 0x10, 0x31, 0x0C, 0x11, 0x51, 0x1F, 0x12, 0x81, 0x30, 0x13, 0x91, 0x41, 0x14, 0x81, 0x50, 0x15, 0x71, 0x5F, 0x16, 0x71, 0x6D, 0x17, 0x41, 0x7A, 0x18, 0x01, 0x86, 0x18, 0xC1, 0x92, 0x19, 0x71, 0x9D, 0x1A, 0x21, 0xA7, 0x1A, 0xC1, 0xB1, 0x1B, 0x61, 0xBB, 0x1C, 0x01, 0xC5, 0x1C, 0xA1, 0xCF, 0x1D, 0x31, 0xD8, 0x1D, 0xD1, 0xE1, 0x1E, 0x61, 0xEA, 0x1E, 0xF1, 0xF3, 0x1F, 0x71, 0xFB, 0x1F, 0xF2, 0x04, 0x20, 0x82, 0x0C, 0x21, 0x02, 0x14, 0x21, 0x72, 0x1B, 0x21, 0xF2, 0x23, 0x22, 0x72, 0x2A, 0x22, 0xE2, 0x32, 0x23, 0x52, 0x39, 0x23, 0xC2, 0x40, 0x24, 0x32, 0x47, 0x24, 0xA2, 0x4E, 0x25, 0x12, 0x54, 0x25, 0x82, 0x5B, 0x25, 0xE2, 0x62, 0x26, 0x52, 0x68, 0x26, 0xB2, 0x6E, 0x27, 0x22, 0x75, 0x27, 0x82, 0x7B, 0x27, 0xE2, 0x81, 0x28, 0x42, 0x87, 0x28, 0xA2, 0x8D, 0x29, 0x02, 0x92, 0x29, 0x52, 0x98, 0x29, 0xB2, 0x9E, 0x2A, 0x02, 0xA3, 0x2A, 0x62, 0xA9, 0x2A, 0xB2, 0xAE, 0x2B, 0x12, 0xB3, 0x2B, 0x62, 0xB9, 0x2B, 0xC2, 0xBE, 0x2C, 0x12, 0xC4, 0x2C, 0x62, 0xC9, 0x2C, 0xB2, 0xCE, 0x2D, 0x12, 0xD3, 0x2D, 0x62, 0xD8, 0x2D, 0xB2, 0xDE, 0x2E, 0x12, 0xE4, 0x2E, 0x62, 0xE9, 0x2E, 0xB2, 0xEE, 0x2F, 0x02, 0xF3, 0x2F, 0x52, 0xF7, 0x2F, 0xA2, 0xFC, 0x2F, 0xE3, 0x01, 0x30, 0x33, 0x05, 0x30, 0x73, 0x09, 0x30, 0xC3, 0x0E, 0x31, 0x03, 0x12, 0x31, 0x43, 0x16, 0x31, 0x93, 0x1B, 0x31, 0xD3, 0x1E, 0x32, 0x03, 0x22, 0x32, 0x43, 0x26, 0x32, 0x83, 0x2A, 0x32, 0xC3, 0x2E, 0x33, 0x03, 0x32, 0x33, 0x43, 0x36, 0x33, 0x83, 0x3A,
    138, _NON_AUTOINC, 0x66, 0x33, 0xC3, 0x3E, 0x34, 0x03, 0x42, 0x34, 0x43, 0x46, 0x34, 0x83, 0x4A, 0x34, 0xC3, 0x4E, 0x35, 0x03, 0x51, 0x35, 0x33, 0x55, 0x35, 0x73, 0x59, 0x35, 0xB3, 0x5D, 0x35, 0xE3, 0x5F, 0x36, 0x13, 0x63, 0x36, 0x53, 0x67, 0x36, 0x93, 0x6B, 0x36, 0xD3, 0x6E, 0x37, 0x03, 0x72, 0x37, 0x43, 0x76, 0x37, 0x83, 0x7A, 0x37, 0xC3, 0x7E, 0x38, 0x03, 0x82, 0x38, 0x43, 0x86, 0x38, 0x83, 0x8A, 0x38, 0xC3, 0x8E, 0x39, 0x03, 0x92, 0x39, 0x43, 0x96, 0x39, 0x83, 0x9A, 0x39, 0xC3, 0x9E, 0x39, 0xF3, 0xA1, 0x3A, 0x33, 0xA5, 0x3A, 0x73, 0xA9, 0x3A, 0xC3, 0xAE, 0x3B, 0x03, 0xB2, 0x3B, 0x53, 0xB7, 0x3B, 0x93, 0xBC, 0x3B, 0xE3, 0xC1, 0x3C, 0x43, 0xC6, 0x3C, 0x93, 0xCC, 0x3C, 0xE3, 0xD1, 0x3D, 0x43, 0xD7, 0x3D, 0xA3, 0xDD, 0x3D, 0xF3, 0xE2, 0x3E, 0x53, 0xE9, 0x3E, 0xC3, 0xEF, 0x3F, 0x33, 0xF6, 0x3F, 0xA3, 0xFC, 0x3F, 0xC0, 0x00,

    4, _NON_AUTOINC, 0x67, 0x90,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x08, 0x20, 0x9B, 0x0A, 0xF0, 0xC0, 0x0D, 0x00, 0xDD, 0x0E, 0x90, 0xF4, 0x0F, 0xF1, 0x09, 0x11, 0x41, 0x1E, 0x12, 0x81, 0x31, 0x13, 0xA1, 0x43, 0x14, 0xB1, 0x53, 0x15, 0xB1, 0x64, 0x16, 0xB1, 0x72, 0x17, 0x91, 0x80, 0x18, 0x71, 0x8D, 0x19, 0x31, 0x99, 0x19, 0xF1, 0xA5, 0x1A, 0xA1, 0xB0, 0x1B, 0x51, 0xBB, 0x1C, 0x01, 0xC5, 0x1C, 0xB1, 0xD0, 0x1D, 0x51, 0xDA, 0x1D, 0xF1, 0xE4, 0x1E, 0x91, 0xEE, 0x1F, 0x21, 0xF7, 0x1F, 0xB2, 0x00, 0x20, 0x42, 0x09, 0x20, 0xD2, 0x11, 0x21, 0x52, 0x19, 0x21, 0xD2, 0x21, 0x22, 0x52, 0x29, 0x22, 0xD2, 0x30, 0x23, 0x42, 0x38, 0x23, 0xC2, 0x3F, 0x24, 0x32, 0x47, 0x24, 0xA2, 0x4E, 0x25, 0x12, 0x55, 0x25, 0x82, 0x5C, 0x26, 0x02, 0x63, 0x26, 0x62, 0x6A, 0x26, 0xD2, 0x70, 0x27, 0x42, 0x77, 0x27, 0xA2, 0x7D, 0x28, 0x02, 0x84, 0x28, 0x72, 0x8A, 0x28, 0xD2, 0x90, 0x29, 0x32, 0x96, 0x29, 0x92, 0x9C, 0x29, 0xF2, 0xA2, 0x2A, 0x52, 0xA8, 0x2A, 0xB2, 0xAE, 0x2B, 0x02, 0xB3, 0x2B, 0x62, 0xB9, 0x2B, 0xC2, 0xBE, 0x2C, 0x12, 0xC4, 0x2C, 0x72, 0xC9, 0x2C, 0xC2, 0xCF, 0x2D, 0x12, 0xD4, 0x2D, 0x72, 0xD9, 0x2D, 0xC2, 0xDF, 0x2E, 0x22, 0xE4, 0x2E, 0x72, 0xE9, 0x2E, 0xC2, 0xEE, 0x2F, 0x12, 0xF3, 0x2F, 0x52, 0xF8, 0x2F, 0xA2, 0xFC, 0x2F, 0xF3, 0x01, 0x30, 0x33, 0x06, 0x30, 0x83, 0x0A, 0x30, 0xC3, 0x0F, 0x31, 0x13, 0x13, 0x31, 0x53, 0x17, 0x31, 0x93, 0x1B, 0x31, 0xD3, 0x1F, 0x32, 0x13, 0x23, 0x32, 0x53, 0x27, 0x32, 0x93, 0x2B, 0x32, 0xD3, 0x2F, 0x33, 0x13, 0x33, 0x33, 0x53, 0x37, 0x33, 0x93, 0x3B, 0x33, 0xD3, 0x3F, 0x34, 0x13, 0x43, 0x34, 0x53, 0x47, 0x34, 0x93, 0x4B,
    138, _NON_AUTOINC, 0x66, 0x34, 0xD3, 0x4F, 0x35, 0x13, 0x53, 0x35, 0x53, 0x57, 0x35, 0x93, 0x5B, 0x35, 0xD3, 0x5F, 0x36, 0x03, 0x62, 0x36, 0x43, 0x66, 0x36, 0x83, 0x6A, 0x36, 0xC3, 0x6E, 0x37, 0x03, 0x72, 0x37, 0x33, 0x75, 0x37, 0x73, 0x79, 0x37, 0xB3, 0x7D, 0x37, 0xF3, 0x80, 0x38, 0x23, 0x84, 0x38, 0x63, 0x88, 0x38, 0xA3, 0x8C, 0x38, 0xD3, 0x8F, 0x39, 0x13, 0x93, 0x39, 0x53, 0x96, 0x39, 0x83, 0x9A, 0x39, 0xC3, 0x9D, 0x39, 0xE3, 0x9F, 0x3A, 0x03, 0xA2, 0x3A, 0x43, 0xA6, 0x3A, 0x83, 0xA9, 0x3A, 0xB3, 0xAD, 0x3A, 0xF3, 0xB1, 0x3B, 0x33, 0xB5, 0x3B, 0x73, 0xB9, 0x3B, 0xB3, 0xBD, 0x3B, 0xF3, 0xC2, 0x3C, 0x43, 0xC6, 0x3C, 0x83, 0xCA, 0x3C, 0xD3, 0xCF, 0x3D, 0x13, 0xD4, 0x3D, 0x63, 0xD9, 0x3D, 0xB3, 0xDD, 0x3D, 0xF3, 0xE2, 0x3E, 0x43, 0xE7, 0x3E, 0x93, 0xEC, 0x3E, 0xF3, 0xF1, 0x3F, 0x43, 0xF7, 0x3F, 0xA3, 0xFC, 0x3F, 0xC0, 0x00,

    4, _NON_AUTOINC, 0x67, 0xA0,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x08, 0xB0, 0xA3, 0x0B, 0x40, 0xC4, 0x0D, 0x30, 0xE0, 0x0E, 0xB0, 0xF4, 0x0F, 0xE1, 0x08, 0x11, 0x11, 0x1A, 0x12, 0x51, 0x2D, 0x13, 0x61, 0x3E, 0x14, 0x61, 0x4E, 0x15, 0x61, 0x5E, 0x16, 0x61, 0x6D, 0x17, 0x41, 0x7A, 0x18, 0x11, 0x87, 0x18, 0xD1, 0x93, 0x19, 0x91, 0x9F, 0x1A, 0x41, 0xAA, 0x1A, 0xF1, 0xB4, 0x1B, 0x91, 0xBF, 0x1C, 0x41, 0xC9, 0x1C, 0xD1, 0xD2, 0x1D, 0x71, 0xDC, 0x1E, 0x01, 0xE5, 0x1E, 0xA1, 0xEE, 0x1F, 0x21, 0xF7, 0x1F, 0xB1, 0xFF, 0x20, 0x32, 0x08, 0x20, 0xC2, 0x10, 0x21, 0x42, 0x18, 0x21, 0xC2, 0x20, 0x22, 0x42, 0x28, 0x22, 0xB2, 0x2F, 0x23, 0x32, 0x36, 0x23, 0xA2, 0x3E, 0x24, 0x12, 0x45, 0x24, 0x82, 0x4B, 0x24, 0xF2, 0x52, 0x25, 0x62, 0x59, 0x25, 0xC2, 0x5F, 0x26, 0x32, 0x66, 0x26, 0x92, 0x6C, 0x26, 0xF2, 0x72, 0x27, 0x52, 0x79, 0x27, 0xC2, 0x7F, 0x28, 0x22, 0x84, 0x28, 0x72, 0x8A, 0x28, 0xD2, 0x90, 0x29, 0x32, 0x96, 0x29, 0x92, 0x9B, 0x29, 0xE2, 0xA0, 0x2A, 0x32, 0xA6, 0x2A, 0x82, 0xAB, 0x2A, 0xE2, 0xB1, 0x2B, 0x32, 0xB6, 0x2B, 0x92, 0xBB, 0x2B, 0xE2, 0xC1, 0x2C, 0x32, 0xC6, 0x2C, 0x82, 0xCB, 0x2C, 0xE2, 0xD0, 0x2D, 0x32, 0xD5, 0x2D, 0x82, 0xDB, 0x2D, 0xE2, 0xE1, 0x2E, 0x42, 0xE6, 0x2E, 0x92, 0xEB, 0x2E, 0xD2, 0xF0, 0x2F, 0x22, 0xF5, 0x2F, 0x72, 0xF9, 0x2F, 0xC2, 0xFE, 0x30, 0x03, 0x02, 0x30, 0x43, 0x07, 0x30, 0x93, 0x0B, 0x30, 0xD3, 0x0F, 0x31, 0x13, 0x13, 0x31, 0x63, 0x18, 0x31, 0xA3, 0x1C, 0x31, 0xD3, 0x1F, 0x32, 0x13, 0x23, 0x32, 0x53, 0x27, 0x32, 0x93, 0x2B, 0x32, 0xD3, 0x2F, 0x33, 0x13, 0x33, 0x33, 0x43, 0x36, 0x33, 0x83, 0x3A, 0x33, 0xC3, 0x3E,
    138, _NON_AUTOINC, 0x66, 0x34, 0x03, 0x42, 0x34, 0x43, 0x46, 0x34, 0x83, 0x4A, 0x34, 0xB3, 0x4D, 0x34, 0xF3, 0x51, 0x35, 0x33, 0x55, 0x35, 0x73, 0x59, 0x35, 0xA3, 0x5C, 0x35, 0xF3, 0x61, 0x36, 0x33, 0x64, 0x36, 0x63, 0x68, 0x36, 0xA3, 0x6C, 0x36, 0xD3, 0x6F, 0x37, 0x13, 0x73, 0x37, 0x43, 0x76, 0x37, 0x83, 0x79, 0x37, 0xB3, 0x7D, 0x37, 0xE3, 0x80, 0x38, 0x23, 0x83, 0x38, 0x53, 0x87, 0x38, 0x83, 0x8A, 0x38, 0xC3, 0x8D, 0x38, 0xF3, 0x90, 0x39, 0x23, 0x94, 0x39, 0x53, 0x97, 0x39, 0x83, 0x9A, 0x39, 0xB3, 0x9C, 0x39, 0xD3, 0x9D, 0x39, 0xE3, 0x9E, 0x39, 0xF3, 0x9F, 0x3A, 0x03, 0xA2, 0x3A, 0x33, 0xA5, 0x3A, 0x63, 0xA8, 0x3A, 0xA3, 0xAB, 0x3A, 0xD3, 0xAF, 0x3B, 0x13, 0xB3, 0x3B, 0x53, 0xB7, 0x3B, 0x93, 0xBB, 0x3B, 0xE3, 0xC0, 0x3C, 0x33, 0xC6, 0x3C, 0x93, 0xCC, 0x3C, 0xF3, 0xD3, 0x3D, 0x73, 0xDD, 0x3E, 0x53, 0xFC, 0x3F, 0xC0, 0x00,
    4, _NON_AUTOINC, 0x67, 0x40,
    _END
};

BYTE code tPCM_TEST_SETB[] =
{
    //---------inputgamma-------------
    4, _NON_AUTOINC, 0x9F, 0x09,
    4, _NON_AUTOINC, 0xA1, 0x80,
    102, _NON_AUTOINC, 0xA0, 0x00, 0x00, 0x06, 0x00, 0xE0, 0x18, 0x02, 0x40, 0x3C, 0x05, 0xA0, 0x7F, 0x0A, 0xA0, 0xDC, 0x11, 0x61, 0x56, 0x19, 0xF1, 0xEE, 0x24, 0x62, 0xA5, 0x30, 0xD3, 0x7C, 0x3F, 0x31, 0x1D, 0x13, 0xF1, 0x63, 0x18, 0x91, 0xB2, 0x1D, 0xC2, 0x09, 0x23, 0x82, 0x69, 0x29, 0xC2, 0xD2, 0x30, 0xA3, 0x44, 0x38, 0x03, 0xBF, 0x10, 0x01, 0x11, 0x12, 0x21, 0x34, 0x14, 0x71, 0x5A, 0x16, 0xE1, 0x82, 0x19, 0x71, 0xAD, 0x1C, 0x31, 0xDA, 0x1F, 0x22, 0x0A, 0x22, 0x32, 0x3C, 0x25, 0x62, 0x70, 0x28, 0xC2, 0xA8, 0x2C, 0x42, 0xE1, 0x2F, 0xF3, 0x1D, 0x33, 0xD3, 0x5C, 0x37, 0xD3, 0x9E, 0x3B, 0xF3, 0xE2, 0x3F, 0xC0, 0x00,
    4, _NON_AUTOINC, 0xA1, 0x40,

    4, _NON_AUTOINC, 0xA2, 0x12,
    4, _NON_AUTOINC, 0xA3, 0x21,
    //---------srgb-------------
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x62, 0x44,
    27, _NON_AUTOINC, 0x63, 0x01, 0x3D, 0x00, 0x96, 0x00, 0x00, 0x00, 0x07, 0x01, 0xAA, 0x00, 0x00, 0x00, 0x04, 0x00, 0x22, 0x01, 0xD9, 0x00, 0x55, 0x00, 0x66, 0x00, 0x77,
    4, _NON_AUTOINC, 0x62, 0x84,

    //---------outputgamma-------------
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x67, 0x84,
    27, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x03, 0x00, 0x40, 0x05, 0x00, 0x60, 0x07,

    4, _NON_AUTOINC, 0x67, 0x94,
    27, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x03, 0x00, 0x40, 0x05, 0x00, 0x60, 0x07,

    4, _NON_AUTOINC, 0x67, 0xA4,
    27, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x03, 0x00, 0x40, 0x05, 0x00, 0x60, 0x07,

    4, _NON_AUTOINC, 0x67, 0x80,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0C, 0x01, 0x00, 0x14, 0x01, 0x80, 0x1C, 0x02, 0x00, 0x24, 0x02, 0x80, 0x2C, 0x03, 0x00, 0x34, 0x03, 0x80, 0x3C, 0x04, 0x00, 0x44, 0x04, 0x80, 0x4C, 0x05, 0x00, 0x54, 0x05, 0x80, 0x5C, 0x06, 0x00, 0x64, 0x06, 0x80, 0x6C, 0x07, 0x00, 0x74, 0x07, 0x80, 0x7C, 0x08, 0x00, 0x84, 0x08, 0x80, 0x8C, 0x09, 0x00, 0x94, 0x09, 0x80, 0x9C, 0x0A, 0x00, 0xA4, 0x0A, 0x80, 0xAC, 0x0B, 0x00, 0xB4, 0x0B, 0x80, 0xBC, 0x0C, 0x00, 0xC4, 0x0C, 0x80, 0xCC, 0x0D, 0x00, 0xD4, 0x0D, 0x80, 0xDC, 0x0E, 0x00, 0xE4, 0x0E, 0x80, 0xEC, 0x0F, 0x00, 0xF4, 0x0F, 0x80, 0xFC, 0x10, 0x01, 0x04, 0x10, 0x81, 0x0C, 0x11, 0x01, 0x14, 0x11, 0x81, 0x1C, 0x12, 0x01, 0x24, 0x12, 0x81, 0x2C, 0x13, 0x01, 0x34, 0x13, 0x81, 0x3C, 0x14, 0x01, 0x44, 0x14, 0x81, 0x4C, 0x15, 0x01, 0x54, 0x15, 0x81, 0x5C, 0x16, 0x01, 0x64, 0x16, 0x81, 0x6C, 0x17, 0x01, 0x74, 0x17, 0x81, 0x7C, 0x18, 0x01, 0x84, 0x18, 0x81, 0x8C, 0x19, 0x01, 0x94, 0x19, 0x81, 0x9C, 0x1A, 0x01, 0xA4, 0x1A, 0x81, 0xAC, 0x1B, 0x01, 0xB4, 0x1B, 0x81, 0xBC, 0x1C, 0x01, 0xC4, 0x1C, 0x81, 0xCC, 0x1D, 0x01, 0xD4, 0x1D, 0x81, 0xDC, 0x1E, 0x01, 0xE4, 0x1E, 0x81, 0xEC, 0x1F, 0x01, 0xF4, 0x1F, 0x81, 0xFC, 0x20, 0x02, 0x04, 0x20, 0x82, 0x0C, 0x21, 0x02, 0x14, 0x21, 0x82, 0x1C, 0x22, 0x02, 0x24, 0x22, 0x82, 0x2C, 0x23, 0x02, 0x34, 0x23, 0x82, 0x3C, 0x24, 0x02, 0x44, 0x24, 0x82, 0x4C, 0x25, 0x02, 0x54, 0x25, 0x82, 0x5C, 0x26, 0x02, 0x64, 0x26, 0x82, 0x6C, 0x27, 0x02, 0x74, 0x27, 0x82, 0x7C, 0x28, 0x02, 0x84, 0x28, 0x82, 0x8C, 0x29, 0x02, 0x94, 0x29, 0x82, 0x9C,
    138, _NON_AUTOINC, 0x66, 0x2A, 0x02, 0xA4, 0x2A, 0x82, 0xAC, 0x2B, 0x02, 0xB4, 0x2B, 0x82, 0xBC, 0x2C, 0x02, 0xC4, 0x2C, 0x82, 0xCC, 0x2D, 0x02, 0xD4, 0x2D, 0x82, 0xDC, 0x2E, 0x02, 0xE4, 0x2E, 0x82, 0xEC, 0x2F, 0x02, 0xF4, 0x2F, 0x82, 0xFC, 0x30, 0x03, 0x04, 0x30, 0x83, 0x0C, 0x31, 0x03, 0x14, 0x31, 0x83, 0x1C, 0x32, 0x03, 0x24, 0x32, 0x83, 0x2C, 0x33, 0x03, 0x34, 0x33, 0x83, 0x3C, 0x34, 0x03, 0x44, 0x34, 0x83, 0x4C, 0x35, 0x03, 0x54, 0x35, 0x83, 0x5C, 0x36, 0x03, 0x64, 0x36, 0x83, 0x6C, 0x37, 0x03, 0x74, 0x37, 0x83, 0x7C, 0x38, 0x03, 0x84, 0x38, 0x83, 0x8C, 0x39, 0x03, 0x94, 0x39, 0x83, 0x9C, 0x3A, 0x03, 0xA4, 0x3A, 0x83, 0xAC, 0x3B, 0x03, 0xB4, 0x3B, 0x83, 0xBC, 0x3C, 0x03, 0xC4, 0x3C, 0x83, 0xCC, 0x3D, 0x03, 0xD4, 0x3D, 0x83, 0xDC, 0x3E, 0x03, 0xE4, 0x3E, 0x83, 0xEC, 0x3F, 0x03, 0xF4, 0x3F, 0x83, 0xFC, 0x3F, 0xC0, 0x00,

    4, _NON_AUTOINC, 0x67, 0x90,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0C, 0x01, 0x00, 0x14, 0x01, 0x80, 0x1C, 0x02, 0x00, 0x24, 0x02, 0x80, 0x2C, 0x03, 0x00, 0x34, 0x03, 0x80, 0x3C, 0x04, 0x00, 0x44, 0x04, 0x80, 0x4C, 0x05, 0x00, 0x54, 0x05, 0x80, 0x5C, 0x06, 0x00, 0x64, 0x06, 0x80, 0x6C, 0x07, 0x00, 0x74, 0x07, 0x80, 0x7C, 0x08, 0x00, 0x84, 0x08, 0x80, 0x8C, 0x09, 0x00, 0x94, 0x09, 0x80, 0x9C, 0x0A, 0x00, 0xA4, 0x0A, 0x80, 0xAC, 0x0B, 0x00, 0xB4, 0x0B, 0x80, 0xBC, 0x0C, 0x00, 0xC4, 0x0C, 0x80, 0xCC, 0x0D, 0x00, 0xD4, 0x0D, 0x80, 0xDC, 0x0E, 0x00, 0xE4, 0x0E, 0x80, 0xEC, 0x0F, 0x00, 0xF4, 0x0F, 0x80, 0xFC, 0x10, 0x01, 0x04, 0x10, 0x81, 0x0C, 0x11, 0x01, 0x14, 0x11, 0x81, 0x1C, 0x12, 0x01, 0x24, 0x12, 0x81, 0x2C, 0x13, 0x01, 0x34, 0x13, 0x81, 0x3C, 0x14, 0x01, 0x44, 0x14, 0x81, 0x4C, 0x15, 0x01, 0x54, 0x15, 0x81, 0x5C, 0x16, 0x01, 0x64, 0x16, 0x81, 0x6C, 0x17, 0x01, 0x74, 0x17, 0x81, 0x7C, 0x18, 0x01, 0x84, 0x18, 0x81, 0x8C, 0x19, 0x01, 0x94, 0x19, 0x81, 0x9C, 0x1A, 0x01, 0xA4, 0x1A, 0x81, 0xAC, 0x1B, 0x01, 0xB4, 0x1B, 0x81, 0xBC, 0x1C, 0x01, 0xC4, 0x1C, 0x81, 0xCC, 0x1D, 0x01, 0xD4, 0x1D, 0x81, 0xDC, 0x1E, 0x01, 0xE4, 0x1E, 0x81, 0xEC, 0x1F, 0x01, 0xF4, 0x1F, 0x81, 0xFC, 0x20, 0x02, 0x04, 0x20, 0x82, 0x0C, 0x21, 0x02, 0x14, 0x21, 0x82, 0x1C, 0x22, 0x02, 0x24, 0x22, 0x82, 0x2C, 0x23, 0x02, 0x34, 0x23, 0x82, 0x3C, 0x24, 0x02, 0x44, 0x24, 0x82, 0x4C, 0x25, 0x02, 0x54, 0x25, 0x82, 0x5C, 0x26, 0x02, 0x64, 0x26, 0x82, 0x6C, 0x27, 0x02, 0x74, 0x27, 0x82, 0x7C, 0x28, 0x02, 0x84, 0x28, 0x82, 0x8C, 0x29, 0x02, 0x94, 0x29, 0x82, 0x9C,
    138, _NON_AUTOINC, 0x66, 0x2A, 0x02, 0xA4, 0x2A, 0x82, 0xAC, 0x2B, 0x02, 0xB4, 0x2B, 0x82, 0xBC, 0x2C, 0x02, 0xC4, 0x2C, 0x82, 0xCC, 0x2D, 0x02, 0xD4, 0x2D, 0x82, 0xDC, 0x2E, 0x02, 0xE4, 0x2E, 0x82, 0xEC, 0x2F, 0x02, 0xF4, 0x2F, 0x82, 0xFC, 0x30, 0x03, 0x04, 0x30, 0x83, 0x0C, 0x31, 0x03, 0x14, 0x31, 0x83, 0x1C, 0x32, 0x03, 0x24, 0x32, 0x83, 0x2C, 0x33, 0x03, 0x34, 0x33, 0x83, 0x3C, 0x34, 0x03, 0x44, 0x34, 0x83, 0x4C, 0x35, 0x03, 0x54, 0x35, 0x83, 0x5C, 0x36, 0x03, 0x64, 0x36, 0x83, 0x6C, 0x37, 0x03, 0x74, 0x37, 0x83, 0x7C, 0x38, 0x03, 0x84, 0x38, 0x83, 0x8C, 0x39, 0x03, 0x94, 0x39, 0x83, 0x9C, 0x3A, 0x03, 0xA4, 0x3A, 0x83, 0xAC, 0x3B, 0x03, 0xB4, 0x3B, 0x83, 0xBC, 0x3C, 0x03, 0xC4, 0x3C, 0x83, 0xCC, 0x3D, 0x03, 0xD4, 0x3D, 0x83, 0xDC, 0x3E, 0x03, 0xE4, 0x3E, 0x83, 0xEC, 0x3F, 0x03, 0xF4, 0x3F, 0x83, 0xFC, 0x3F, 0xC0, 0x00,

    4, _NON_AUTOINC, 0x67, 0xA0,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0C, 0x01, 0x00, 0x14, 0x01, 0x80, 0x1C, 0x02, 0x00, 0x24, 0x02, 0x80, 0x2C, 0x03, 0x00, 0x34, 0x03, 0x80, 0x3C, 0x04, 0x00, 0x44, 0x04, 0x80, 0x4C, 0x05, 0x00, 0x54, 0x05, 0x80, 0x5C, 0x06, 0x00, 0x64, 0x06, 0x80, 0x6C, 0x07, 0x00, 0x74, 0x07, 0x80, 0x7C, 0x08, 0x00, 0x84, 0x08, 0x80, 0x8C, 0x09, 0x00, 0x94, 0x09, 0x80, 0x9C, 0x0A, 0x00, 0xA4, 0x0A, 0x80, 0xAC, 0x0B, 0x00, 0xB4, 0x0B, 0x80, 0xBC, 0x0C, 0x00, 0xC4, 0x0C, 0x80, 0xCC, 0x0D, 0x00, 0xD4, 0x0D, 0x80, 0xDC, 0x0E, 0x00, 0xE4, 0x0E, 0x80, 0xEC, 0x0F, 0x00, 0xF4, 0x0F, 0x80, 0xFC, 0x10, 0x01, 0x04, 0x10, 0x81, 0x0C, 0x11, 0x01, 0x14, 0x11, 0x81, 0x1C, 0x12, 0x01, 0x24, 0x12, 0x81, 0x2C, 0x13, 0x01, 0x34, 0x13, 0x81, 0x3C, 0x14, 0x01, 0x44, 0x14, 0x81, 0x4C, 0x15, 0x01, 0x54, 0x15, 0x81, 0x5C, 0x16, 0x01, 0x64, 0x16, 0x81, 0x6C, 0x17, 0x01, 0x74, 0x17, 0x81, 0x7C, 0x18, 0x01, 0x84, 0x18, 0x81, 0x8C, 0x19, 0x01, 0x94, 0x19, 0x81, 0x9C, 0x1A, 0x01, 0xA4, 0x1A, 0x81, 0xAC, 0x1B, 0x01, 0xB4, 0x1B, 0x81, 0xBC, 0x1C, 0x01, 0xC4, 0x1C, 0x81, 0xCC, 0x1D, 0x01, 0xD4, 0x1D, 0x81, 0xDC, 0x1E, 0x01, 0xE4, 0x1E, 0x81, 0xEC, 0x1F, 0x01, 0xF4, 0x1F, 0x81, 0xFC, 0x20, 0x02, 0x04, 0x20, 0x82, 0x0C, 0x21, 0x02, 0x14, 0x21, 0x82, 0x1C, 0x22, 0x02, 0x24, 0x22, 0x82, 0x2C, 0x23, 0x02, 0x34, 0x23, 0x82, 0x3C, 0x24, 0x02, 0x44, 0x24, 0x82, 0x4C, 0x25, 0x02, 0x54, 0x25, 0x82, 0x5C, 0x26, 0x02, 0x64, 0x26, 0x82, 0x6C, 0x27, 0x02, 0x74, 0x27, 0x82, 0x7C, 0x28, 0x02, 0x84, 0x28, 0x82, 0x8C, 0x29, 0x02, 0x94, 0x29, 0x82, 0x9C,
    138, _NON_AUTOINC, 0x66, 0x2A, 0x02, 0xA4, 0x2A, 0x82, 0xAC, 0x2B, 0x02, 0xB4, 0x2B, 0x82, 0xBC, 0x2C, 0x02, 0xC4, 0x2C, 0x82, 0xCC, 0x2D, 0x02, 0xD4, 0x2D, 0x82, 0xDC, 0x2E, 0x02, 0xE4, 0x2E, 0x82, 0xEC, 0x2F, 0x02, 0xF4, 0x2F, 0x82, 0xFC, 0x30, 0x03, 0x04, 0x30, 0x83, 0x0C, 0x31, 0x03, 0x14, 0x31, 0x83, 0x1C, 0x32, 0x03, 0x24, 0x32, 0x83, 0x2C, 0x33, 0x03, 0x34, 0x33, 0x83, 0x3C, 0x34, 0x03, 0x44, 0x34, 0x83, 0x4C, 0x35, 0x03, 0x54, 0x35, 0x83, 0x5C, 0x36, 0x03, 0x64, 0x36, 0x83, 0x6C, 0x37, 0x03, 0x74, 0x37, 0x83, 0x7C, 0x38, 0x03, 0x84, 0x38, 0x83, 0x8C, 0x39, 0x03, 0x94, 0x39, 0x83, 0x9C, 0x3A, 0x03, 0xA4, 0x3A, 0x83, 0xAC, 0x3B, 0x03, 0xB4, 0x3B, 0x83, 0xBC, 0x3C, 0x03, 0xC4, 0x3C, 0x83, 0xCC, 0x3D, 0x03, 0xD4, 0x3D, 0x83, 0xDC, 0x3E, 0x03, 0xE4, 0x3E, 0x83, 0xEC, 0x3F, 0x03, 0xF4, 0x3F, 0x83, 0xFC, 0x3F, 0xC0, 0x00,
    4, _NON_AUTOINC, 0x67, 0x40,
    _END
};

BYTE code tPCM_TEST_SETC[] =
{
    //---------inputgamma-------------
    4, _NON_AUTOINC, 0x9F, 0x09,
    4, _NON_AUTOINC, 0xA1, 0x80,
    102, _NON_AUTOINC, 0xA0, 0x00, 0x00, 0x14, 0x02, 0x80, 0x3C, 0x05, 0x50, 0x72, 0x09, 0x50, 0xBE, 0x0E, 0xC1, 0x20, 0x15, 0xA1, 0x9B, 0x1E, 0x22, 0x30, 0x28, 0x52, 0xE1, 0x34, 0x53, 0xAF, 0x10, 0x81, 0x27, 0x14, 0x71, 0x6A, 0x18, 0xE1, 0xB5, 0x1D, 0xD2, 0x08, 0x23, 0x52, 0x64, 0x29, 0x52, 0xC8, 0x2F, 0xE3, 0x36, 0x37, 0x13, 0xAE, 0x3E, 0xC1, 0x0C, 0x11, 0xC1, 0x2E, 0x14, 0x01, 0x53, 0x16, 0x71, 0x7B, 0x18, 0xF1, 0xA5, 0x1B, 0xB1, 0xD2, 0x1E, 0x92, 0x01, 0x21, 0xA2, 0x33, 0x24, 0xD2, 0x68, 0x28, 0x32, 0xA0, 0x2B, 0xC2, 0xDA, 0x2F, 0x83, 0x17, 0x33, 0x73, 0x58, 0x37, 0x93, 0x9B, 0x3B, 0xD3, 0xE1, 0x3F, 0xC0, 0x00,
    4, _NON_AUTOINC, 0xA1, 0x40,

    4, _NON_AUTOINC, 0xA2, 0x11,
    4, _NON_AUTOINC, 0xA3, 0x22,
    //---------srgb-------------
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x62, 0x44,
    27, _NON_AUTOINC, 0x63, 0x00, 0x35, 0x80, 0x02, 0x80, 0x00, 0x00, 0x01, 0x00, 0x35, 0x00, 0x01, 0x00, 0x01, 0x80, 0x01, 0x80, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    4, _NON_AUTOINC, 0x62, 0x84,

    4, _NON_AUTOINC, 0x68, 0x40,
    //---------outputgamma-------------
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x67, 0x84,
    27, _NON_AUTOINC, 0x66, 0x00, 0x40, 0x09, 0x00, 0xE0, 0x13, 0x01, 0x80, 0x00, 0x02, 0xA0, 0x23, 0x00, 0x00, 0x30, 0x04, 0x10, 0x4E, 0x05, 0x80, 0x61, 0x06, 0xA0, 0x72,

    4, _NON_AUTOINC, 0x67, 0x94,
    27, _NON_AUTOINC, 0x66, 0x00, 0x40, 0x0B, 0x01, 0x20, 0x18, 0x01, 0xF0, 0x00, 0x03, 0x00, 0x29, 0x00, 0x00, 0x36, 0x04, 0x80, 0x56, 0x06, 0x10, 0x6B, 0x07, 0x30, 0x7B,

    4, _NON_AUTOINC, 0x67, 0xA4,
    27, _NON_AUTOINC, 0x66, 0x00, 0x40, 0x0B, 0x01, 0x30, 0x1A, 0x02, 0x10, 0x00, 0x03, 0x70, 0x2E, 0x00, 0x00, 0x3D, 0x04, 0xE0, 0x5B, 0x06, 0x70, 0x73, 0x07, 0xC0, 0x84,

    4, _NON_AUTOINC, 0x67, 0x80,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x07, 0x90, 0x92, 0x0A, 0x60, 0xB7, 0x0C, 0x50, 0xD2, 0x0D, 0xD0, 0xE8, 0x0F, 0x00, 0xFA, 0x10, 0x31, 0x0C, 0x11, 0x51, 0x1F, 0x12, 0x81, 0x30, 0x13, 0x91, 0x41, 0x14, 0x81, 0x50, 0x15, 0x71, 0x5F, 0x16, 0x71, 0x6D, 0x17, 0x41, 0x7A, 0x18, 0x01, 0x86, 0x18, 0xC1, 0x92, 0x19, 0x71, 0x9D, 0x1A, 0x21, 0xA7, 0x1A, 0xC1, 0xB1, 0x1B, 0x61, 0xBB, 0x1C, 0x01, 0xC5, 0x1C, 0xA1, 0xCF, 0x1D, 0x31, 0xD8, 0x1D, 0xD1, 0xE1, 0x1E, 0x61, 0xEA, 0x1E, 0xF1, 0xF3, 0x1F, 0x71, 0xFB, 0x1F, 0xF2, 0x04, 0x20, 0x82, 0x0C, 0x21, 0x02, 0x14, 0x21, 0x72, 0x1B, 0x21, 0xF2, 0x23, 0x22, 0x72, 0x2A, 0x22, 0xE2, 0x32, 0x23, 0x52, 0x39, 0x23, 0xC2, 0x40, 0x24, 0x32, 0x47, 0x24, 0xA2, 0x4E, 0x25, 0x12, 0x54, 0x25, 0x82, 0x5B, 0x25, 0xE2, 0x62, 0x26, 0x52, 0x68, 0x26, 0xB2, 0x6E, 0x27, 0x22, 0x75, 0x27, 0x82, 0x7B, 0x27, 0xE2, 0x81, 0x28, 0x42, 0x87, 0x28, 0xA2, 0x8D, 0x29, 0x02, 0x92, 0x29, 0x52, 0x98, 0x29, 0xB2, 0x9E, 0x2A, 0x02, 0xA3, 0x2A, 0x62, 0xA9, 0x2A, 0xB2, 0xAE, 0x2B, 0x12, 0xB3, 0x2B, 0x62, 0xB9, 0x2B, 0xC2, 0xBE, 0x2C, 0x12, 0xC4, 0x2C, 0x62, 0xC9, 0x2C, 0xB2, 0xCE, 0x2D, 0x12, 0xD3, 0x2D, 0x62, 0xD8, 0x2D, 0xB2, 0xDE, 0x2E, 0x12, 0xE4, 0x2E, 0x62, 0xE9, 0x2E, 0xB2, 0xEE, 0x2F, 0x02, 0xF3, 0x2F, 0x52, 0xF7, 0x2F, 0xA2, 0xFC, 0x2F, 0xE3, 0x01, 0x30, 0x33, 0x05, 0x30, 0x73, 0x09, 0x30, 0xC3, 0x0E, 0x31, 0x03, 0x12, 0x31, 0x43, 0x16, 0x31, 0x93, 0x1B, 0x31, 0xD3, 0x1E, 0x32, 0x03, 0x22, 0x32, 0x43, 0x26, 0x32, 0x83, 0x2A, 0x32, 0xC3, 0x2E, 0x33, 0x03, 0x32, 0x33, 0x43, 0x36, 0x33, 0x83, 0x3A,
    138, _NON_AUTOINC, 0x66, 0x33, 0xC3, 0x3E, 0x34, 0x03, 0x42, 0x34, 0x43, 0x46, 0x34, 0x83, 0x4A, 0x34, 0xC3, 0x4E, 0x35, 0x03, 0x51, 0x35, 0x33, 0x55, 0x35, 0x73, 0x59, 0x35, 0xB3, 0x5D, 0x35, 0xE3, 0x5F, 0x36, 0x13, 0x63, 0x36, 0x53, 0x67, 0x36, 0x93, 0x6B, 0x36, 0xD3, 0x6E, 0x37, 0x03, 0x72, 0x37, 0x43, 0x76, 0x37, 0x83, 0x7A, 0x37, 0xC3, 0x7E, 0x38, 0x03, 0x82, 0x38, 0x43, 0x86, 0x38, 0x83, 0x8A, 0x38, 0xC3, 0x8E, 0x39, 0x03, 0x92, 0x39, 0x43, 0x96, 0x39, 0x83, 0x9A, 0x39, 0xC3, 0x9E, 0x39, 0xF3, 0xA1, 0x3A, 0x33, 0xA5, 0x3A, 0x73, 0xA9, 0x3A, 0xC3, 0xAE, 0x3B, 0x03, 0xB2, 0x3B, 0x53, 0xB7, 0x3B, 0x93, 0xBC, 0x3B, 0xE3, 0xC1, 0x3C, 0x43, 0xC6, 0x3C, 0x93, 0xCC, 0x3C, 0xE3, 0xD1, 0x3D, 0x43, 0xD7, 0x3D, 0xA3, 0xDD, 0x3D, 0xF3, 0xE2, 0x3E, 0x53, 0xE9, 0x3E, 0xC3, 0xEF, 0x3F, 0x33, 0xF4, 0x3F, 0x53, 0xF6, 0x3F, 0xC0, 0x00,

    4, _NON_AUTOINC, 0x67, 0x90,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x08, 0x20, 0x9B, 0x0A, 0xF0, 0xC0, 0x0D, 0x00, 0xDD, 0x0E, 0x90, 0xF4, 0x0F, 0xF1, 0x09, 0x11, 0x41, 0x1E, 0x12, 0x81, 0x31, 0x13, 0xA1, 0x43, 0x14, 0xB1, 0x53, 0x15, 0xB1, 0x64, 0x16, 0xB1, 0x72, 0x17, 0x91, 0x80, 0x18, 0x71, 0x8D, 0x19, 0x31, 0x99, 0x19, 0xF1, 0xA5, 0x1A, 0xA1, 0xB0, 0x1B, 0x51, 0xBB, 0x1C, 0x01, 0xC5, 0x1C, 0xB1, 0xD0, 0x1D, 0x51, 0xDA, 0x1D, 0xF1, 0xE4, 0x1E, 0x91, 0xEE, 0x1F, 0x21, 0xF7, 0x1F, 0xB2, 0x00, 0x20, 0x42, 0x09, 0x20, 0xD2, 0x11, 0x21, 0x52, 0x19, 0x21, 0xD2, 0x21, 0x22, 0x52, 0x29, 0x22, 0xD2, 0x30, 0x23, 0x42, 0x38, 0x23, 0xC2, 0x3F, 0x24, 0x32, 0x47, 0x24, 0xA2, 0x4E, 0x25, 0x12, 0x55, 0x25, 0x82, 0x5C, 0x26, 0x02, 0x63, 0x26, 0x62, 0x6A, 0x26, 0xD2, 0x70, 0x27, 0x42, 0x77, 0x27, 0xA2, 0x7D, 0x28, 0x02, 0x84, 0x28, 0x72, 0x8A, 0x28, 0xD2, 0x90, 0x29, 0x32, 0x96, 0x29, 0x92, 0x9C, 0x29, 0xF2, 0xA2, 0x2A, 0x52, 0xA8, 0x2A, 0xB2, 0xAE, 0x2B, 0x02, 0xB3, 0x2B, 0x62, 0xB9, 0x2B, 0xC2, 0xBE, 0x2C, 0x12, 0xC4, 0x2C, 0x72, 0xC9, 0x2C, 0xC2, 0xCF, 0x2D, 0x12, 0xD4, 0x2D, 0x72, 0xD9, 0x2D, 0xC2, 0xDF, 0x2E, 0x22, 0xE4, 0x2E, 0x72, 0xE9, 0x2E, 0xC2, 0xEE, 0x2F, 0x12, 0xF3, 0x2F, 0x52, 0xF8, 0x2F, 0xA2, 0xFC, 0x2F, 0xF3, 0x01, 0x30, 0x33, 0x06, 0x30, 0x83, 0x0A, 0x30, 0xC3, 0x0F, 0x31, 0x13, 0x13, 0x31, 0x53, 0x17, 0x31, 0x93, 0x1B, 0x31, 0xD3, 0x1F, 0x32, 0x13, 0x23, 0x32, 0x53, 0x27, 0x32, 0x93, 0x2B, 0x32, 0xD3, 0x2F, 0x33, 0x13, 0x33, 0x33, 0x53, 0x37, 0x33, 0x93, 0x3B, 0x33, 0xD3, 0x3F, 0x34, 0x13, 0x43, 0x34, 0x53, 0x47, 0x34, 0x93, 0x4B,
    138, _NON_AUTOINC, 0x66, 0x34, 0xD3, 0x4F, 0x35, 0x13, 0x53, 0x35, 0x53, 0x57, 0x35, 0x93, 0x5B, 0x35, 0xD3, 0x5F, 0x36, 0x03, 0x62, 0x36, 0x43, 0x66, 0x36, 0x83, 0x6A, 0x36, 0xC3, 0x6E, 0x37, 0x03, 0x72, 0x37, 0x33, 0x75, 0x37, 0x73, 0x79, 0x37, 0xB3, 0x7D, 0x37, 0xF3, 0x80, 0x38, 0x23, 0x84, 0x38, 0x63, 0x88, 0x38, 0xA3, 0x8C, 0x38, 0xD3, 0x8F, 0x39, 0x13, 0x93, 0x39, 0x53, 0x96, 0x39, 0x83, 0x9A, 0x39, 0xC3, 0x9D, 0x39, 0xE3, 0x9F, 0x3A, 0x03, 0xA2, 0x3A, 0x43, 0xA6, 0x3A, 0x83, 0xA9, 0x3A, 0xB3, 0xAD, 0x3A, 0xF3, 0xB1, 0x3B, 0x33, 0xB5, 0x3B, 0x73, 0xB9, 0x3B, 0xB3, 0xBD, 0x3B, 0xF3, 0xC2, 0x3C, 0x43, 0xC6, 0x3C, 0x83, 0xCA, 0x3C, 0xD3, 0xCF, 0x3D, 0x13, 0xD4, 0x3D, 0x63, 0xD9, 0x3D, 0xB3, 0xDD, 0x3D, 0xF3, 0xE2, 0x3E, 0x43, 0xE7, 0x3E, 0x93, 0xEC, 0x3E, 0xF3, 0xF1, 0x3F, 0x43, 0xF5, 0x3F, 0x63, 0xF7, 0x3F, 0xC0, 0x00,

    4, _NON_AUTOINC, 0x67, 0xA0,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x08, 0xB0, 0xA3, 0x0B, 0x40, 0xC4, 0x0D, 0x30, 0xE0, 0x0E, 0xB0, 0xF4, 0x0F, 0xE1, 0x08, 0x11, 0x11, 0x1A, 0x12, 0x51, 0x2D, 0x13, 0x61, 0x3E, 0x14, 0x61, 0x4E, 0x15, 0x61, 0x5E, 0x16, 0x61, 0x6D, 0x17, 0x41, 0x7A, 0x18, 0x11, 0x87, 0x18, 0xD1, 0x93, 0x19, 0x91, 0x9F, 0x1A, 0x41, 0xAA, 0x1A, 0xF1, 0xB4, 0x1B, 0x91, 0xBF, 0x1C, 0x41, 0xC9, 0x1C, 0xD1, 0xD2, 0x1D, 0x71, 0xDC, 0x1E, 0x01, 0xE5, 0x1E, 0xA1, 0xEE, 0x1F, 0x21, 0xF7, 0x1F, 0xB1, 0xFF, 0x20, 0x32, 0x08, 0x20, 0xC2, 0x10, 0x21, 0x42, 0x18, 0x21, 0xC2, 0x20, 0x22, 0x42, 0x28, 0x22, 0xB2, 0x2F, 0x23, 0x32, 0x36, 0x23, 0xA2, 0x3E, 0x24, 0x12, 0x45, 0x24, 0x82, 0x4B, 0x24, 0xF2, 0x52, 0x25, 0x62, 0x59, 0x25, 0xC2, 0x5F, 0x26, 0x32, 0x66, 0x26, 0x92, 0x6C, 0x26, 0xF2, 0x72, 0x27, 0x52, 0x79, 0x27, 0xC2, 0x7F, 0x28, 0x22, 0x84, 0x28, 0x72, 0x8A, 0x28, 0xD2, 0x90, 0x29, 0x32, 0x96, 0x29, 0x92, 0x9B, 0x29, 0xE2, 0xA0, 0x2A, 0x32, 0xA6, 0x2A, 0x82, 0xAB, 0x2A, 0xE2, 0xB1, 0x2B, 0x32, 0xB6, 0x2B, 0x92, 0xBB, 0x2B, 0xE2, 0xC1, 0x2C, 0x32, 0xC6, 0x2C, 0x82, 0xCB, 0x2C, 0xE2, 0xD0, 0x2D, 0x32, 0xD5, 0x2D, 0x82, 0xDB, 0x2D, 0xE2, 0xE1, 0x2E, 0x42, 0xE6, 0x2E, 0x92, 0xEB, 0x2E, 0xD2, 0xF0, 0x2F, 0x22, 0xF5, 0x2F, 0x72, 0xF9, 0x2F, 0xC2, 0xFE, 0x30, 0x03, 0x02, 0x30, 0x43, 0x07, 0x30, 0x93, 0x0B, 0x30, 0xD3, 0x0F, 0x31, 0x13, 0x13, 0x31, 0x63, 0x18, 0x31, 0xA3, 0x1C, 0x31, 0xD3, 0x1F, 0x32, 0x13, 0x23, 0x32, 0x53, 0x27, 0x32, 0x93, 0x2B, 0x32, 0xD3, 0x2F, 0x33, 0x13, 0x33, 0x33, 0x43, 0x36, 0x33, 0x83, 0x3A, 0x33, 0xC3, 0x3E,
    138, _NON_AUTOINC, 0x66, 0x34, 0x03, 0x42, 0x34, 0x43, 0x46, 0x34, 0x83, 0x4A, 0x34, 0xB3, 0x4D, 0x34, 0xF3, 0x51, 0x35, 0x33, 0x55, 0x35, 0x73, 0x59, 0x35, 0xA3, 0x5C, 0x35, 0xF3, 0x61, 0x36, 0x33, 0x64, 0x36, 0x63, 0x68, 0x36, 0xA3, 0x6C, 0x36, 0xD3, 0x6F, 0x37, 0x13, 0x73, 0x37, 0x43, 0x76, 0x37, 0x83, 0x79, 0x37, 0xB3, 0x7D, 0x37, 0xE3, 0x80, 0x38, 0x23, 0x83, 0x38, 0x53, 0x87, 0x38, 0x83, 0x8A, 0x38, 0xC3, 0x8D, 0x38, 0xF3, 0x90, 0x39, 0x23, 0x94, 0x39, 0x53, 0x97, 0x39, 0x83, 0x9A, 0x39, 0xB3, 0x9C, 0x39, 0xD3, 0x9D, 0x39, 0xE3, 0x9E, 0x39, 0xF3, 0x9F, 0x3A, 0x03, 0xA2, 0x3A, 0x33, 0xA5, 0x3A, 0x63, 0xA8, 0x3A, 0xA3, 0xAB, 0x3A, 0xD3, 0xAF, 0x3B, 0x13, 0xB3, 0x3B, 0x53, 0xB7, 0x3B, 0x93, 0xBB, 0x3B, 0xE3, 0xC0, 0x3C, 0x33, 0xC6, 0x3C, 0x93, 0xCC, 0x3C, 0xF3, 0xD3, 0x3D, 0x73, 0xDD, 0x3E, 0x53, 0xF2, 0x3F, 0xC0, 0x00,
    4, _NON_AUTOINC, 0x67, 0x40,
    _END
};

// -----------CRC Table of PCM, 1680x1050--------
BYTE code tPCM_CRC_MODE0[] =
{
    0xdb, 0x29, 0x03, 0x14, 0x58, 0x5c,
    _END
};

BYTE code tPCM_CRC_MODE1[] =
{
    0x91, 0xba, 0xa5, 0x15, 0x3f, 0xf0,
    _END
};

BYTE code tPCM_CRC_MODE2[] =
{
    0x16, 0x35, 0xd8, 0x8b, 0x53, 0x1c,
    _END
};

BYTE code tPCM_CRC_MODE3[] =
{
    0x62, 0x55, 0xbe, 0x43, 0xef, 0xaa,
    _END
};

BYTE code tPCM_CRC_MODE4[] =
{
    0x60, 0xaf, 0x52, 0xfb, 0x49, 0x37,
    _END
};

BYTE code tPCM_CRC_MODE5[] =
{
    0x56, 0x9a, 0xb4, 0xd7, 0x64, 0x32,
    _END
};

BYTE code tPCM_CRC_MODE6[] =
{
    0x36, 0x71, 0xd6, 0x63, 0xbb, 0xc4,
    _END
};

BYTE code tPCM_CRC_MODE7[] =
{
    0x54, 0x55, 0x6c, 0x96, 0x97, 0x52,
    _END
};

BYTE code tPCM_CRC_MODE8[] =
{
    0x36, 0x44, 0xe2, 0x9a, 0xee, 0x39,
    _END
};

//--------------------------------------------------
// Code Tables of SRGB
//--------------------------------------------------
BYTE code tSRGB_TEST_SETA[] =
{
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x62, 0x44,
    27, _NON_AUTOINC, 0x63, 0x01, 0xAA, 0x00, 0x14, 0x00, 0x02, 0x00, 0x0A, 0x01, 0xA6, 0x00, 0x09, 0x00, 0x06, 0x00, 0x0B, 0x01, 0xEE, 0x00, 0x55, 0x00, 0x66, 0x00, 0x77,
    4, _NON_AUTOINC, 0x62, 0x84,
    _END
};

BYTE code tSRGB_TEST_SETB[] =
{
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x62, 0x44,
    27, _NON_AUTOINC, 0x63, 0x01, 0x3D, 0x00, 0x96, 0x00, 0x00, 0x00, 0x07, 0x01, 0xAA, 0x00, 0x00, 0x00, 0x04, 0x00, 0x22, 0x01, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    4, _NON_AUTOINC, 0x62, 0x84,
    _END
};

BYTE code tSRGB_TEST_SETC[] =
{
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x62, 0x44,
    27, _NON_AUTOINC, 0x63, 0x81, 0xE7, 0x01, 0xED, 0x00, 0x00, 0x01, 0xFF, 0x01, 0xF5, 0x00, 0x00, 0x81, 0xFF, 0x01, 0xFC, 0x01, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    4, _NON_AUTOINC, 0x62, 0x84,
    _END
};

// -----------CRC Table of SRGB, 1680x1050--------
BYTE code tSRGB_CRC_MODE0[] =
{
    0x28, 0x63, 0x35, 0x3b, 0x7c, 0x61,
    _END
};

BYTE code tSRGB_CRC_MODE1[] =
{
    0xd5, 0xc3, 0x30, 0x39, 0x79, 0x5e,
    _END
};

BYTE code tSRGB_CRC_MODE2[] =
{
    0x63, 0xae, 0x99, 0xba, 0x80, 0x90,
    _END
};

BYTE code tSRGB_CRC_MODE3[] =
{
    0xa4, 0xab, 0x32, 0xfb, 0x50, 0x74,
    _END
};

BYTE code tSRGB_CRC_MODE4[] =
{
    0x8a, 0xa7, 0x17, 0x3a, 0xb2, 0x82,
    _END
};

//--------------------------------------------------
// Code Tables of Output Gamma
//--------------------------------------------------
BYTE code tOG_TEST_SETA[] =
{
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x67, 0x80,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x01, 0x00, 0x40, 0x08, 0x00, 0xB0, 0x0F, 0x01, 0x20, 0x17, 0x01, 0xB0, 0x20, 0x02, 0x50, 0x29, 0x02, 0xD0, 0x30, 0x03, 0x30, 0x37, 0x03, 0xA0, 0x3F, 0x04, 0x20, 0x45, 0x04, 0x90, 0x4D, 0x05, 0x10, 0x55, 0x05, 0xA0, 0x5F, 0x06, 0x20, 0x66, 0x06, 0xA0, 0x6D, 0x07, 0x20, 0x77, 0x07, 0xA0, 0x7D, 0x08, 0x10, 0x86, 0x08, 0xA0, 0x8E, 0x09, 0x10, 0x94, 0x09, 0x90, 0x9D, 0x0A, 0x20, 0xA6, 0x0A, 0xB0, 0xAF, 0x0B, 0x30, 0xB7, 0x0B, 0xB0, 0xC0, 0x0C, 0x30, 0xC7, 0x0C, 0xB0, 0xCE, 0x0D, 0x20, 0xD6, 0x0D, 0xB0, 0xDE, 0x0E, 0x20, 0xE6, 0x0E, 0x90, 0xED, 0x0F, 0x20, 0xF5, 0x0F, 0x90, 0xFD, 0x10, 0x01, 0x04, 0x10, 0x81, 0x0C, 0x11, 0x11, 0x14, 0x11, 0x81, 0x1C, 0x12, 0x01, 0x25, 0x12, 0x91, 0x2D, 0x13, 0x01, 0x35, 0x13, 0x91, 0x3D, 0x14, 0x01, 0x45, 0x14, 0x91, 0x4C, 0x15, 0x01, 0x55, 0x15, 0x91, 0x5D, 0x16, 0x01, 0x63, 0x16, 0x81, 0x6C, 0x17, 0x01, 0x74, 0x17, 0x91, 0x7D, 0x18, 0x01, 0x84, 0x18, 0x81, 0x8D, 0x19, 0x11, 0x94, 0x19, 0x81, 0x9C, 0x1A, 0x11, 0xA5, 0x1A, 0x91, 0xAD, 0x1B, 0x11, 0xB5, 0x1B, 0x81, 0xBC, 0x1C, 0x11, 0xC4, 0x1C, 0x81, 0xCC, 0x1D, 0x01, 0xD4, 0x1D, 0x91, 0xDD, 0x1E, 0x11, 0xE4, 0x1E, 0x81, 0xEC, 0x1F, 0x01, 0xF4, 0x1F, 0x91, 0xFD, 0x20, 0x12, 0x05, 0x20, 0x72, 0x0B, 0x20, 0xF2, 0x13, 0x21, 0x72, 0x1B, 0x21, 0xF2, 0x23, 0x22, 0x72, 0x2B, 0x22, 0xF2, 0x33, 0x23, 0x72, 0x3B, 0x23, 0xF2, 0x43, 0x24, 0x72, 0x4B, 0x24, 0xE2, 0x53, 0x25, 0x72, 0x5A, 0x25, 0xE2, 0x63, 0x26, 0x72, 0x6B, 0x26, 0xE2, 0x74, 0x27, 0x82, 0x7C, 0x27, 0xF2, 0x83, 0x28, 0x72, 0x8B, 0x29, 0x02, 0x94,
    138, _NON_AUTOINC, 0x66, 0x29, 0x82, 0x9C, 0x2A, 0x02, 0xA3, 0x2A, 0x72, 0xAD, 0x2B, 0x02, 0xB4, 0x2B, 0x82, 0xBC, 0x2C, 0x02, 0xC4, 0x2C, 0x72, 0xCC, 0x2D, 0x12, 0xD3, 0x2D, 0x82, 0xDB, 0x2D, 0xF2, 0xE4, 0x2E, 0x72, 0xEB, 0x2F, 0x02, 0xF3, 0x2F, 0x72, 0xFC, 0x30, 0x13, 0x04, 0x30, 0x83, 0x0D, 0x30, 0xF3, 0x15, 0x31, 0x93, 0x1C, 0x32, 0x13, 0x25, 0x32, 0x83, 0x2D, 0x33, 0x13, 0x34, 0x33, 0xA3, 0x3E, 0x34, 0x13, 0x46, 0x34, 0xA3, 0x4D, 0x35, 0x33, 0x56, 0x35, 0xA3, 0x60, 0x36, 0x33, 0x67, 0x36, 0xC3, 0x6F, 0x37, 0x33, 0x79, 0x37, 0xB3, 0x80, 0x38, 0x53, 0x88, 0x38, 0xE3, 0x92, 0x39, 0x63, 0x9A, 0x39, 0xE3, 0xA4, 0x3A, 0x73, 0xAC, 0x3A, 0xF3, 0xB4, 0x3B, 0x93, 0xBD, 0x3C, 0x23, 0xC7, 0x3C, 0xB3, 0xD0, 0x3D, 0x43, 0xD8, 0x3D, 0xE3, 0xE2, 0x3E, 0x63, 0xE9, 0x3E, 0xC3, 0xF0, 0x3F, 0x43, 0xF7, 0x3F, 0x93, 0xFC, 0x3F, 0xC0, 0x00,

    4, _NON_AUTOINC, 0x67, 0x90,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x00, 0x00, 0x20, 0x05, 0x00, 0x80, 0x0C, 0x00, 0xF0, 0x12, 0x01, 0x50, 0x19, 0x01, 0xD0, 0x21, 0x02, 0x50, 0x29, 0x02, 0xD0, 0x31, 0x03, 0x50, 0x39, 0x03, 0xD0, 0x41, 0x04, 0x50, 0x49, 0x04, 0xC0, 0x50, 0x05, 0x40, 0x58, 0x05, 0xC0, 0x60, 0x06, 0x40, 0x68, 0x06, 0xC0, 0x70, 0x07, 0x40, 0x78, 0x07, 0xC0, 0x80, 0x08, 0x50, 0x89, 0x08, 0xD0, 0x91, 0x09, 0x50, 0x99, 0x09, 0xD0, 0xA1, 0x0A, 0x50, 0xA9, 0x0A, 0xD0, 0xB1, 0x0B, 0x50, 0xB9, 0x0B, 0xD0, 0xC1, 0x0C, 0x50, 0xC9, 0x0C, 0xD0, 0xD1, 0x0D, 0x50, 0xD9, 0x0D, 0xB0, 0xDF, 0x0E, 0x30, 0xE7, 0x0E, 0xB0, 0xEF, 0x0F, 0x20, 0xF6, 0x0F, 0x90, 0xFC, 0x10, 0x01, 0x05, 0x10, 0x91, 0x0D, 0x11, 0x11, 0x15, 0x11, 0x71, 0x1B, 0x11, 0xF1, 0x23, 0x12, 0x81, 0x2C, 0x13, 0x01, 0x33, 0x13, 0x61, 0x3B, 0x13, 0xF1, 0x43, 0x14, 0x71, 0x4B, 0x14, 0xF1, 0x52, 0x15, 0x61, 0x5A, 0x15, 0xE1, 0x62, 0x16, 0x61, 0x6A, 0x16, 0xE1, 0x72, 0x17, 0x61, 0x7A, 0x17, 0xE1, 0x82, 0x18, 0x61, 0x8A, 0x18, 0xD1, 0x91, 0x19, 0x51, 0x99, 0x19, 0xD1, 0xA1, 0x1A, 0x51, 0xA9, 0x1A, 0xD1, 0xB1, 0x1B, 0x51, 0xB9, 0x1B, 0xD1, 0xC1, 0x1C, 0x51, 0xC9, 0x1C, 0xC1, 0xCF, 0x1D, 0x31, 0xD9, 0x1D, 0xD1, 0xE1, 0x1E, 0x51, 0xE9, 0x1E, 0xD1, 0xF0, 0x1F, 0x41, 0xF8, 0x1F, 0xB1, 0xFF, 0x20, 0x32, 0x07, 0x20, 0xB2, 0x0F, 0x21, 0x32, 0x17, 0x21, 0xB2, 0x1F, 0x22, 0x32, 0x27, 0x22, 0xB2, 0x2F, 0x23, 0x32, 0x37, 0x23, 0xB2, 0x3F, 0x24, 0x22, 0x46, 0x24, 0xA2, 0x50, 0x25, 0x42, 0x58, 0x25, 0xC2, 0x5F, 0x26, 0x42, 0x68, 0x26, 0xC2, 0x6F, 0x27, 0x32, 0x77, 0x27, 0xB2, 0x7F, 0x28, 0x22, 0x86,
    138, _NON_AUTOINC, 0x66, 0x28, 0xB2, 0x90, 0x29, 0x42, 0x99, 0x29, 0xD2, 0xA0, 0x2A, 0x42, 0xA8, 0x2A, 0xC2, 0xB0, 0x2B, 0x32, 0xB9, 0x2B, 0xD2, 0xC1, 0x2C, 0x52, 0xC9, 0x2C, 0xC2, 0xD1, 0x2D, 0x62, 0xDA, 0x2D, 0xE2, 0xE2, 0x2E, 0x52, 0xE9, 0x2E, 0xE2, 0xF2, 0x2F, 0x62, 0xFB, 0x2F, 0xF3, 0x04, 0x30, 0x73, 0x0B, 0x30, 0xE3, 0x13, 0x31, 0x83, 0x1B, 0x32, 0x03, 0x23, 0x32, 0x83, 0x2D, 0x33, 0x03, 0x35, 0x33, 0xA3, 0x3D, 0x34, 0x23, 0x45, 0x34, 0xA3, 0x4E, 0x35, 0x43, 0x57, 0x35, 0xC3, 0x5F, 0x36, 0x53, 0x68, 0x36, 0xD3, 0x70, 0x37, 0x63, 0x7A, 0x37, 0xE3, 0x83, 0x38, 0x73, 0x8D, 0x39, 0x03, 0x94, 0x39, 0x93, 0x9D, 0x3A, 0x23, 0xA6, 0x3A, 0xB3, 0xAF, 0x3B, 0x33, 0xB9, 0x3B, 0xD3, 0xC2, 0x3C, 0x63, 0xCA, 0x3C, 0xF3, 0xD3, 0x3D, 0x83, 0xDD, 0x3E, 0x33, 0xE7, 0x3E, 0xC3, 0xF0, 0x3F, 0x23, 0xF4, 0x3F, 0x83, 0xFC, 0x3F, 0xC0, 0x00,

    4, _NON_AUTOINC, 0x67, 0xA0,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x01, 0x00, 0x40, 0x08, 0x00, 0xB0, 0x0D, 0x01, 0x00, 0x12, 0x01, 0x50, 0x19, 0x01, 0xB0, 0x1E, 0x02, 0x20, 0x25, 0x02, 0x80, 0x2E, 0x03, 0x20, 0x35, 0x03, 0x90, 0x3E, 0x04, 0x10, 0x44, 0x04, 0xB0, 0x4F, 0x05, 0x20, 0x56, 0x05, 0xA0, 0x5E, 0x06, 0x20, 0x67, 0x06, 0xB0, 0x6E, 0x07, 0x20, 0x78, 0x07, 0xB0, 0x7F, 0x08, 0x20, 0x86, 0x08, 0xC0, 0x90, 0x09, 0x30, 0x99, 0x09, 0xE0, 0xA1, 0x0A, 0x40, 0xA8, 0x0A, 0xE0, 0xB2, 0x0B, 0x60, 0xB9, 0x0B, 0xD0, 0xC2, 0x0C, 0x50, 0xC8, 0x0C, 0xD0, 0xD1, 0x0D, 0x60, 0xD9, 0x0D, 0xD0, 0xE0, 0x0E, 0x30, 0xE8, 0x0E, 0xB0, 0xEF, 0x0F, 0x40, 0xF8, 0x0F, 0xB0, 0xFE, 0x10, 0x21, 0x05, 0x10, 0x81, 0x0B, 0x10, 0xF1, 0x14, 0x11, 0x91, 0x1C, 0x11, 0xF1, 0x24, 0x12, 0x71, 0x2B, 0x12, 0xE1, 0x31, 0x13, 0x61, 0x3A, 0x13, 0xD1, 0x41, 0x14, 0x41, 0x48, 0x14, 0xD1, 0x51, 0x15, 0x41, 0x59, 0x15, 0xD1, 0x60, 0x16, 0x41, 0x69, 0x16, 0xC1, 0x70, 0x17, 0x31, 0x77, 0x17, 0xB1, 0x7E, 0x18, 0x31, 0x87, 0x18, 0xB1, 0x90, 0x19, 0x31, 0x97, 0x19, 0xA1, 0x9F, 0x1A, 0x31, 0xA7, 0x1A, 0xA1, 0xAE, 0x1B, 0x21, 0xB6, 0x1B, 0xA1, 0xBD, 0x1C, 0x11, 0xC6, 0x1C, 0x91, 0xCD, 0x1D, 0x21, 0xD5, 0x1D, 0x91, 0xDE, 0x1E, 0x11, 0xE5, 0x1E, 0xA1, 0xED, 0x1F, 0x11, 0xF6, 0x1F, 0x91, 0xFD, 0x20, 0x22, 0x06, 0x20, 0x92, 0x0D, 0x21, 0x22, 0x15, 0x21, 0x92, 0x1D, 0x22, 0x22, 0x26, 0x22, 0x92, 0x2D, 0x23, 0x22, 0x35, 0x23, 0x92, 0x3E, 0x24, 0x12, 0x45, 0x24, 0x92, 0x4E, 0x25, 0x22, 0x56, 0x25, 0xA2, 0x5D, 0x26, 0x22, 0x66, 0x26, 0xA2, 0x6D, 0x27, 0x12, 0x75, 0x27, 0xA2, 0x7E, 0x28, 0x12, 0x85,
    138, _NON_AUTOINC, 0x66, 0x28, 0x92, 0x8E, 0x29, 0x22, 0x95, 0x29, 0x92, 0x9D, 0x2A, 0x22, 0xA6, 0x2A, 0x92, 0xAD, 0x2B, 0x12, 0xB6, 0x2B, 0xA2, 0xBD, 0x2C, 0x22, 0xC7, 0x2C, 0xA2, 0xCE, 0x2D, 0x22, 0xD5, 0x2D, 0xA2, 0xDF, 0x2E, 0x22, 0xE6, 0x2E, 0xA2, 0xF0, 0x2F, 0x32, 0xF7, 0x2F, 0xB2, 0xFF, 0x30, 0x33, 0x07, 0x30, 0xB3, 0x0F, 0x31, 0x23, 0x18, 0x31, 0xC3, 0x20, 0x32, 0x43, 0x28, 0x32, 0xC3, 0x30, 0x33, 0x33, 0x39, 0x33, 0xD3, 0x42, 0x34, 0x63, 0x4A, 0x34, 0xE3, 0x52, 0x35, 0x63, 0x5B, 0x35, 0xF3, 0x63, 0x36, 0x83, 0x6B, 0x36, 0xE3, 0x73, 0x37, 0x73, 0x7C, 0x38, 0x03, 0x85, 0x38, 0x93, 0x8C, 0x39, 0x23, 0x95, 0x39, 0x93, 0x9E, 0x3A, 0x23, 0xA6, 0x3A, 0xC3, 0xB0, 0x3B, 0x43, 0xB9, 0x3B, 0xD3, 0xC2, 0x3C, 0x63, 0xCB, 0x3C, 0xF3, 0xD4, 0x3D, 0x83, 0xDD, 0x3E, 0x13, 0xE6, 0x3E, 0xB3, 0xF0, 0x3F, 0x53, 0xFC, 0x3F, 0xC0, 0x00,
    4, _NON_AUTOINC, 0x67, 0x40,
    _END
};

BYTE code tOG_TEST_SETB[] =
{
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x67, 0x80,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x6C, 0x09, 0x30, 0xAF, 0x0C, 0x60, 0xDA, 0x0E, 0xC0, 0xFC, 0x10, 0xA1, 0x18, 0x12, 0x31, 0x2F, 0x13, 0x91, 0x44, 0x14, 0xF1, 0x57, 0x16, 0x01, 0x68, 0x17, 0x11, 0x79, 0x18, 0x11, 0x89, 0x19, 0x01, 0x97, 0x19, 0xE1, 0xA4, 0x1A, 0xA1, 0xB0, 0x1B, 0x61, 0xBD, 0x1C, 0x31, 0xC9, 0x1C, 0xF1, 0xD5, 0x1D, 0xB1, 0xE0, 0x1E, 0x51, 0xE9, 0x1E, 0xC1, 0xF0, 0x1F, 0x71, 0xFC, 0x20, 0x02, 0x06, 0x20, 0xA2, 0x0F, 0x21, 0x42, 0x18, 0x21, 0xC2, 0x20, 0x22, 0x42, 0x27, 0x22, 0xC2, 0x2F, 0x23, 0x22, 0x36, 0x23, 0xB2, 0x3E, 0x24, 0x22, 0x46, 0x24, 0xB2, 0x4F, 0x25, 0x32, 0x57, 0x25, 0xB2, 0x5E, 0x26, 0x12, 0x64, 0x26, 0x62, 0x6A, 0x26, 0xE2, 0x72, 0x27, 0x52, 0x77, 0x27, 0xB2, 0x7F, 0x28, 0x12, 0x84, 0x28, 0x72, 0x8B, 0x28, 0xE2, 0x92, 0x29, 0x52, 0x98, 0x29, 0xA2, 0x9D, 0x29, 0xF2, 0xA1, 0x2A, 0x32, 0xA5, 0x2A, 0x72, 0xAA, 0x2A, 0xE2, 0xB1, 0x2B, 0x42, 0xB7, 0x2B, 0xA2, 0xBD, 0x2C, 0x12, 0xC4, 0x2C, 0x72, 0xCB, 0x2C, 0xE2, 0xD2, 0x2D, 0x52, 0xD6, 0x2D, 0x82, 0xDB, 0x2D, 0xE2, 0xE2, 0x2E, 0x52, 0xE8, 0x2E, 0xB2, 0xEE, 0x2F, 0x12, 0xF4, 0x2F, 0x72, 0xFA, 0x2F, 0xD3, 0x00, 0x30, 0x23, 0x03, 0x30, 0x53, 0x08, 0x30, 0xB3, 0x0D, 0x31, 0x03, 0x12, 0x31, 0x33, 0x15, 0x31, 0x83, 0x1B, 0x31, 0xD3, 0x20, 0x32, 0x33, 0x25, 0x32, 0x63, 0x28, 0x32, 0xA3, 0x2D, 0x32, 0xE3, 0x2F, 0x33, 0x13, 0x34, 0x33, 0x53, 0x36, 0x33, 0x83, 0x3A, 0x33, 0xD3, 0x3E, 0x33, 0xF3, 0x41, 0x34, 0x43, 0x45, 0x34, 0x63, 0x48, 0x34, 0x93, 0x4A, 0x34, 0xC3, 0x4E, 0x35, 0x03, 0x52, 0x35, 0x33, 0x54, 0x35, 0x73, 0x59, 0x35, 0xA3, 0x5B,
    138, _NON_AUTOINC, 0x66, 0x35, 0xD3, 0x60, 0x36, 0x13, 0x63, 0x36, 0x43, 0x66, 0x36, 0x93, 0x6B, 0x36, 0xE3, 0x70, 0x37, 0x13, 0x72, 0x37, 0x43, 0x75, 0x37, 0x63, 0x77, 0x37, 0x93, 0x7B, 0x37, 0xE3, 0x81, 0x38, 0x33, 0x85, 0x38, 0x63, 0x87, 0x38, 0x93, 0x8B, 0x38, 0xE3, 0x90, 0x39, 0x33, 0x95, 0x39, 0x83, 0x9A, 0x39, 0xC3, 0x9E, 0x39, 0xF3, 0xA0, 0x3A, 0x13, 0xA3, 0x3A, 0x43, 0xA7, 0x3A, 0x93, 0xAA, 0x3A, 0xB3, 0xAD, 0x3B, 0x03, 0xB1, 0x3B, 0x23, 0xB4, 0x3B, 0x63, 0xB9, 0x3B, 0xB3, 0xBE, 0x3C, 0x03, 0xC2, 0x3C, 0x33, 0xC5, 0x3C, 0x83, 0xC9, 0x3C, 0xB3, 0xCD, 0x3D, 0x03, 0xD2, 0x3D, 0x33, 0xD6, 0x3D, 0x93, 0xDC, 0x3D, 0xE3, 0xE0, 0x3E, 0x23, 0xE4, 0x3E, 0x63, 0xE8, 0x3E, 0xA3, 0xEB, 0x3E, 0xC3, 0xED, 0x3E, 0xF3, 0xF0, 0x3F, 0x13, 0xF2, 0x3F, 0x43, 0xF5, 0x3F, 0x73, 0xF8, 0x3F, 0x93, 0xFA, 0x3F, 0xC3, 0xFC, 0x3F, 0xC0, 0x00,

    4, _NON_AUTOINC, 0x67, 0x90,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x68, 0x08, 0xE0, 0xAB, 0x0C, 0x20, 0xD5, 0x0E, 0x70, 0xF7, 0x10, 0x51, 0x12, 0x11, 0xE1, 0x2A, 0x13, 0x41, 0x3F, 0x14, 0x91, 0x53, 0x15, 0xC1, 0x65, 0x16, 0xD1, 0x75, 0x17, 0xD1, 0x85, 0x18, 0xC1, 0x93, 0x19, 0xA1, 0xA0, 0x1A, 0x71, 0xAD, 0x1B, 0x31, 0xB9, 0x1B, 0xF1, 0xC5, 0x1C, 0xB1, 0xD1, 0x1D, 0x71, 0xDC, 0x1E, 0x21, 0xE7, 0x1E, 0xA1, 0xEE, 0x1F, 0x21, 0xF9, 0x1F, 0xE2, 0x03, 0x20, 0x82, 0x0D, 0x21, 0x22, 0x15, 0x21, 0xA2, 0x1E, 0x22, 0x22, 0x25, 0x22, 0x92, 0x2D, 0x23, 0x12, 0x34, 0x23, 0x82, 0x3D, 0x24, 0x02, 0x44, 0x24, 0x82, 0x4C, 0x25, 0x02, 0x54, 0x25, 0x82, 0x5C, 0x25, 0xF2, 0x63, 0x26, 0x62, 0x68, 0x26, 0xC2, 0x70, 0x27, 0x42, 0x76, 0x27, 0x92, 0x7D, 0x27, 0xF2, 0x83, 0x28, 0x62, 0x88, 0x28, 0xC2, 0x90, 0x29, 0x32, 0x97, 0x29, 0xA2, 0x9D, 0x2A, 0x12, 0xA4, 0x2A, 0x72, 0xAA, 0x2A, 0xE2, 0xB1, 0x2B, 0x42, 0xB7, 0x2B, 0xA2, 0xBD, 0x2C, 0x02, 0xC4, 0x2C, 0x72, 0xCA, 0x2C, 0xD2, 0xCF, 0x2D, 0x22, 0xD6, 0x2D, 0x92, 0xDB, 0x2D, 0xE2, 0xE1, 0x2E, 0x42, 0xE9, 0x2E, 0xD2, 0xF0, 0x2F, 0x32, 0xF5, 0x2F, 0x72, 0xF9, 0x2F, 0xC3, 0x00, 0x30, 0x13, 0x03, 0x30, 0x53, 0x08, 0x30, 0xB3, 0x0D, 0x30, 0xF3, 0x10, 0x31, 0x33, 0x15, 0x31, 0x73, 0x18, 0x31, 0xB3, 0x1E, 0x32, 0x13, 0x24, 0x32, 0x53, 0x27, 0x32, 0x83, 0x2B, 0x32, 0xE3, 0x30, 0x33, 0x23, 0x33, 0x33, 0x53, 0x36, 0x33, 0x83, 0x3A, 0x33, 0xC3, 0x3E, 0x33, 0xF3, 0x41, 0x34, 0x43, 0x45, 0x34, 0x73, 0x48, 0x34, 0x93, 0x4B, 0x34, 0xD3, 0x4F, 0x35, 0x13, 0x52, 0x35, 0x43, 0x57, 0x35, 0x93, 0x5A, 0x35, 0xB3, 0x5D, 0x36, 0x03, 0x61,
    138, _NON_AUTOINC, 0x66, 0x36, 0x33, 0x64, 0x36, 0x73, 0x69, 0x36, 0xA3, 0x6C, 0x36, 0xE3, 0x70, 0x37, 0x23, 0x73, 0x37, 0x43, 0x76, 0x37, 0x73, 0x78, 0x37, 0xB3, 0x7D, 0x37, 0xF3, 0x80, 0x38, 0x33, 0x85, 0x38, 0x63, 0x87, 0x38, 0xA3, 0x8C, 0x38, 0xE3, 0x8F, 0x39, 0x13, 0x93, 0x39, 0x53, 0x96, 0x39, 0x83, 0x9A, 0x39, 0xC3, 0x9E, 0x39, 0xF3, 0xA1, 0x3A, 0x23, 0xA4, 0x3A, 0x63, 0xA8, 0x3A, 0xA3, 0xAB, 0x3A, 0xD3, 0xAE, 0x3B, 0x03, 0xB2, 0x3B, 0x53, 0xB6, 0x3B, 0x83, 0xB9, 0x3B, 0xB3, 0xBD, 0x3C, 0x03, 0xC1, 0x3C, 0x33, 0xC5, 0x3C, 0x63, 0xC8, 0x3C, 0xA3, 0xCB, 0x3C, 0xD3, 0xCF, 0x3D, 0x13, 0xD2, 0x3D, 0x43, 0xD6, 0x3D, 0x83, 0xD9, 0x3D, 0xB3, 0xDD, 0x3D, 0xF3, 0xE1, 0x3E, 0x43, 0xE6, 0x3E, 0x83, 0xEA, 0x3E, 0xB3, 0xED, 0x3E, 0xE3, 0xEF, 0x3F, 0x03, 0xF2, 0x3F, 0x33, 0xF5, 0x3F, 0x83, 0xF9, 0x3F, 0xB3, 0xFC, 0x3F, 0xC0, 0x00,

    4, _NON_AUTOINC, 0x67, 0xA0,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x6F, 0x09, 0x60, 0xB2, 0x0C, 0xA0, 0xE0, 0x0F, 0x11, 0x01, 0x10, 0xF1, 0x1C, 0x12, 0x71, 0x35, 0x13, 0xF1, 0x4B, 0x15, 0x41, 0x5F, 0x16, 0x71, 0x70, 0x17, 0x91, 0x82, 0x18, 0x91, 0x91, 0x19, 0x91, 0x9F, 0x1A, 0x71, 0xAF, 0x1B, 0x51, 0xBC, 0x1C, 0x21, 0xC9, 0x1D, 0x01, 0xD5, 0x1D, 0xA1, 0xE1, 0x1E, 0x61, 0xEA, 0x1E, 0xD1, 0xF2, 0x1F, 0x91, 0xFF, 0x20, 0x52, 0x0A, 0x20, 0xF2, 0x13, 0x21, 0x92, 0x1C, 0x22, 0x12, 0x26, 0x22, 0xC2, 0x2F, 0x23, 0x32, 0x37, 0x23, 0xD2, 0x41, 0x24, 0x42, 0x48, 0x24, 0xD2, 0x51, 0x25, 0x52, 0x5A, 0x25, 0xE2, 0x61, 0x26, 0x62, 0x69, 0x26, 0xC2, 0x70, 0x27, 0x32, 0x76, 0x27, 0x92, 0x7C, 0x28, 0x02, 0x83, 0x28, 0x62, 0x89, 0x28, 0xC2, 0x90, 0x29, 0x32, 0x96, 0x29, 0x92, 0x9B, 0x29, 0xF2, 0xA2, 0x2A, 0x52, 0xA8, 0x2A, 0xA2, 0xAD, 0x2B, 0x02, 0xB3, 0x2B, 0x62, 0xB9, 0x2B, 0xC2, 0xBF, 0x2C, 0x22, 0xC6, 0x2C, 0xA2, 0xCE, 0x2D, 0x22, 0xD5, 0x2D, 0x82, 0xDB, 0x2D, 0xF2, 0xE2, 0x2E, 0x52, 0xE8, 0x2E, 0xB2, 0xEE, 0x2F, 0x12, 0xF3, 0x2F, 0x52, 0xF7, 0x2F, 0xA2, 0xFD, 0x30, 0x03, 0x02, 0x30, 0x53, 0x07, 0x30, 0xA3, 0x0D, 0x30, 0xF3, 0x11, 0x31, 0x23, 0x14, 0x31, 0x63, 0x17, 0x31, 0x93, 0x1B, 0x31, 0xD3, 0x1E, 0x32, 0x03, 0x23, 0x32, 0x63, 0x28, 0x32, 0xB3, 0x2D, 0x32, 0xE3, 0x30, 0x33, 0x23, 0x33, 0x33, 0x53, 0x36, 0x33, 0x73, 0x38, 0x33, 0xA3, 0x3C, 0x33, 0xD3, 0x3F, 0x34, 0x13, 0x43, 0x34, 0x53, 0x47, 0x34, 0x83, 0x4A, 0x34, 0xC3, 0x4D, 0x34, 0xF3, 0x50, 0x35, 0x23, 0x53, 0x35, 0x43, 0x56, 0x35, 0x93, 0x5B, 0x35, 0xD3, 0x5F, 0x36, 0x13, 0x64, 0x36, 0x73, 0x69,
    138, _NON_AUTOINC, 0x66, 0x36, 0xA3, 0x6C, 0x36, 0xD3, 0x6E, 0x37, 0x03, 0x72, 0x37, 0x53, 0x76, 0x37, 0x73, 0x79, 0x37, 0xA3, 0x7B, 0x37, 0xD3, 0x7E, 0x38, 0x03, 0x81, 0x38, 0x23, 0x84, 0x38, 0x63, 0x88, 0x38, 0xA3, 0x8B, 0x38, 0xD3, 0x8E, 0x38, 0xF3, 0x91, 0x39, 0x23, 0x93, 0x39, 0x53, 0x96, 0x39, 0x83, 0x9A, 0x39, 0xD3, 0x9E, 0x3A, 0x03, 0xA1, 0x3A, 0x33, 0xA4, 0x3A, 0x73, 0xA9, 0x3A, 0xA3, 0xAB, 0x3A, 0xC3, 0xAE, 0x3B, 0x13, 0xB2, 0x3B, 0x43, 0xB7, 0x3B, 0xB3, 0xBD, 0x3B, 0xE3, 0xC0, 0x3C, 0x13, 0xC2, 0x3C, 0x33, 0xC5, 0x3C, 0x73, 0xC8, 0x3C, 0x93, 0xCA, 0x3C, 0xB3, 0xCC, 0x3C, 0xD3, 0xCD, 0x3C, 0xE3, 0xCF, 0x3D, 0x03, 0xD1, 0x3D, 0x23, 0xD2, 0x3D, 0x33, 0xD4, 0x3D, 0x53, 0xD6, 0x3D, 0x63, 0xD7, 0x3D, 0x83, 0xD9, 0x3D, 0xA3, 0xDB, 0x3D, 0xC3, 0xDD, 0x3D, 0xE3, 0xE0, 0x3E, 0x13, 0xE3, 0x3E, 0x63, 0xFC, 0x3F, 0xC0, 0x00,
    4, _NON_AUTOINC, 0x67, 0x40,
    _END
};

BYTE code tOG_TEST_SETC[] =
{
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x67, 0x80,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x6C, 0x09, 0x30, 0xAF, 0x0C, 0x60, 0xDA, 0x0E, 0xC0, 0xFC, 0x10, 0xA1, 0x18, 0x12, 0x31, 0x2F, 0x13, 0x91, 0x44, 0x14, 0xF1, 0x57, 0x16, 0x01, 0x68, 0x17, 0x11, 0x79, 0x18, 0x11, 0x89, 0x19, 0x01, 0x97, 0x19, 0xE1, 0xA4, 0x1A, 0xA1, 0xB0, 0x1B, 0x61, 0xBD, 0x1C, 0x31, 0xC9, 0x1C, 0xF1, 0xD5, 0x1D, 0xB1, 0xE0, 0x1E, 0x51, 0xE9, 0x1E, 0xC1, 0xF0, 0x1F, 0x71, 0xFC, 0x20, 0x02, 0x06, 0x20, 0xA2, 0x0F, 0x21, 0x42, 0x18, 0x21, 0xC2, 0x20, 0x22, 0x42, 0x27, 0x22, 0xC2, 0x2F, 0x23, 0x22, 0x36, 0x23, 0xB2, 0x3E, 0x24, 0x22, 0x46, 0x24, 0xB2, 0x4F, 0x25, 0x32, 0x57, 0x25, 0xB2, 0x5E, 0x26, 0x12, 0x64, 0x26, 0x62, 0x6A, 0x26, 0xE2, 0x72, 0x27, 0x52, 0x77, 0x27, 0xB2, 0x7F, 0x28, 0x12, 0x84, 0x28, 0x72, 0x8B, 0x28, 0xE2, 0x92, 0x29, 0x52, 0x98, 0x29, 0xA2, 0x9D, 0x29, 0xF2, 0xA1, 0x2A, 0x32, 0xA5, 0x2A, 0x72, 0xAA, 0x2A, 0xE2, 0xB1, 0x2B, 0x42, 0xB7, 0x2B, 0xA2, 0xBD, 0x2C, 0x12, 0xC4, 0x2C, 0x72, 0xCB, 0x2C, 0xE2, 0xD2, 0x2D, 0x52, 0xD6, 0x2D, 0x82, 0xDB, 0x2D, 0xE2, 0xE2, 0x2E, 0x52, 0xE8, 0x2E, 0xB2, 0xEE, 0x2F, 0x12, 0xF4, 0x2F, 0x72, 0xFA, 0x2F, 0xD3, 0x00, 0x30, 0x23, 0x03, 0x30, 0x53, 0x08, 0x30, 0xB3, 0x0D, 0x31, 0x03, 0x12, 0x31, 0x33, 0x15, 0x31, 0x83, 0x1B, 0x31, 0xD3, 0x20, 0x32, 0x33, 0x25, 0x32, 0x63, 0x28, 0x32, 0xA3, 0x2D, 0x32, 0xE3, 0x2F, 0x33, 0x13, 0x34, 0x33, 0x53, 0x36, 0x33, 0x83, 0x3A, 0x33, 0xD3, 0x3E, 0x33, 0xF3, 0x41, 0x34, 0x43, 0x45, 0x34, 0x63, 0x48, 0x34, 0x93, 0x4A, 0x34, 0xC3, 0x4E, 0x35, 0x03, 0x52, 0x35, 0x33, 0x54, 0x35, 0x73, 0x59, 0x35, 0xA3, 0x5B,
    138, _NON_AUTOINC, 0x66, 0x35, 0xD3, 0x60, 0x36, 0x13, 0x63, 0x36, 0x43, 0x66, 0x36, 0x93, 0x6B, 0x36, 0xE3, 0x70, 0x37, 0x13, 0x72, 0x37, 0x43, 0x75, 0x37, 0x63, 0x77, 0x37, 0x93, 0x7B, 0x37, 0xE3, 0x81, 0x38, 0x33, 0x85, 0x38, 0x63, 0x87, 0x38, 0x93, 0x8B, 0x38, 0xE3, 0x90, 0x39, 0x33, 0x95, 0x39, 0x83, 0x9A, 0x39, 0xC3, 0x9E, 0x39, 0xF3, 0xA0, 0x3A, 0x13, 0xA3, 0x3A, 0x43, 0xA7, 0x3A, 0x93, 0xAA, 0x3A, 0xB3, 0xAD, 0x3B, 0x03, 0xB1, 0x3B, 0x23, 0xB4, 0x3B, 0x63, 0xB9, 0x3B, 0xB3, 0xBE, 0x3C, 0x03, 0xC2, 0x3C, 0x33, 0xC5, 0x3C, 0x83, 0xC9, 0x3C, 0xB3, 0xCD, 0x3D, 0x03, 0xD2, 0x3D, 0x33, 0xD6, 0x3D, 0x93, 0xDC, 0x3D, 0xE3, 0xE0, 0x3E, 0x23, 0xE4, 0x3E, 0x63, 0xE8, 0x3E, 0xA3, 0xEB, 0x3E, 0xC3, 0xED, 0x3E, 0xF3, 0xF0, 0x3F, 0x13, 0xF2, 0x3F, 0x43, 0xF5, 0x3F, 0x73, 0xF8, 0x3F, 0xC3, 0xFC, 0x3F, 0xC3, 0xFC, 0x3F, 0xC0, 0x00,
    4, _NON_AUTOINC, 0x67, 0x88,
    4, _NON_AUTOINC, 0x66, 0x7E,
    4, _NON_AUTOINC, 0x67, 0x80,
    12, _NON_AUTOINC, 0x66, 0x3F,0xC3,0xFC,0x3F,0xC3,0xFC,0x3F,0xC0,0x00,

    4, _NON_AUTOINC, 0x67, 0x90,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x68, 0x08, 0xE0, 0xAB, 0x0C, 0x20, 0xD5, 0x0E, 0x70, 0xF7, 0x10, 0x51, 0x12, 0x11, 0xE1, 0x2A, 0x13, 0x41, 0x3F, 0x14, 0x91, 0x53, 0x15, 0xC1, 0x65, 0x16, 0xD1, 0x75, 0x17, 0xD1, 0x85, 0x18, 0xC1, 0x93, 0x19, 0xA1, 0xA0, 0x1A, 0x71, 0xAD, 0x1B, 0x31, 0xB9, 0x1B, 0xF1, 0xC5, 0x1C, 0xB1, 0xD1, 0x1D, 0x71, 0xDC, 0x1E, 0x21, 0xE7, 0x1E, 0xA1, 0xEE, 0x1F, 0x21, 0xF9, 0x1F, 0xE2, 0x03, 0x20, 0x82, 0x0D, 0x21, 0x22, 0x15, 0x21, 0xA2, 0x1E, 0x22, 0x22, 0x25, 0x22, 0x92, 0x2D, 0x23, 0x12, 0x34, 0x23, 0x82, 0x3D, 0x24, 0x02, 0x44, 0x24, 0x82, 0x4C, 0x25, 0x02, 0x54, 0x25, 0x82, 0x5C, 0x25, 0xF2, 0x63, 0x26, 0x62, 0x68, 0x26, 0xC2, 0x70, 0x27, 0x42, 0x76, 0x27, 0x92, 0x7D, 0x27, 0xF2, 0x83, 0x28, 0x62, 0x88, 0x28, 0xC2, 0x90, 0x29, 0x32, 0x97, 0x29, 0xA2, 0x9D, 0x2A, 0x12, 0xA4, 0x2A, 0x72, 0xAA, 0x2A, 0xE2, 0xB1, 0x2B, 0x42, 0xB7, 0x2B, 0xA2, 0xBD, 0x2C, 0x02, 0xC4, 0x2C, 0x72, 0xCA, 0x2C, 0xD2, 0xCF, 0x2D, 0x22, 0xD6, 0x2D, 0x92, 0xDB, 0x2D, 0xE2, 0xE1, 0x2E, 0x42, 0xE9, 0x2E, 0xD2, 0xF0, 0x2F, 0x32, 0xF5, 0x2F, 0x72, 0xF9, 0x2F, 0xC3, 0x00, 0x30, 0x13, 0x03, 0x30, 0x53, 0x08, 0x30, 0xB3, 0x0D, 0x30, 0xF3, 0x10, 0x31, 0x33, 0x15, 0x31, 0x73, 0x18, 0x31, 0xB3, 0x1E, 0x32, 0x13, 0x24, 0x32, 0x53, 0x27, 0x32, 0x83, 0x2B, 0x32, 0xE3, 0x30, 0x33, 0x23, 0x33, 0x33, 0x53, 0x36, 0x33, 0x83, 0x3A, 0x33, 0xC3, 0x3E, 0x33, 0xF3, 0x41, 0x34, 0x43, 0x45, 0x34, 0x73, 0x48, 0x34, 0x93, 0x4B, 0x34, 0xD3, 0x4F, 0x35, 0x13, 0x52, 0x35, 0x43, 0x57, 0x35, 0x93, 0x5A, 0x35, 0xB3, 0x5D, 0x36, 0x03, 0x61,
    138, _NON_AUTOINC, 0x66, 0x36, 0x33, 0x64, 0x36, 0x73, 0x69, 0x36, 0xA3, 0x6C, 0x36, 0xE3, 0x70, 0x37, 0x23, 0x73, 0x37, 0x43, 0x76, 0x37, 0x73, 0x78, 0x37, 0xB3, 0x7D, 0x37, 0xF3, 0x80, 0x38, 0x33, 0x85, 0x38, 0x63, 0x87, 0x38, 0xA3, 0x8C, 0x38, 0xE3, 0x8F, 0x39, 0x13, 0x93, 0x39, 0x53, 0x96, 0x39, 0x83, 0x9A, 0x39, 0xC3, 0x9E, 0x39, 0xF3, 0xA1, 0x3A, 0x23, 0xA4, 0x3A, 0x63, 0xA8, 0x3A, 0xA3, 0xAB, 0x3A, 0xD3, 0xAE, 0x3B, 0x03, 0xB2, 0x3B, 0x53, 0xB6, 0x3B, 0x83, 0xB9, 0x3B, 0xB3, 0xBD, 0x3C, 0x03, 0xC1, 0x3C, 0x33, 0xC5, 0x3C, 0x63, 0xC8, 0x3C, 0xA3, 0xCB, 0x3C, 0xD3, 0xCF, 0x3D, 0x13, 0xD2, 0x3D, 0x43, 0xD6, 0x3D, 0x83, 0xD9, 0x3D, 0xB3, 0xDD, 0x3D, 0xF3, 0xE1, 0x3E, 0x43, 0xE6, 0x3E, 0x83, 0xEA, 0x3E, 0xB3, 0xED, 0x3E, 0xE3, 0xEF, 0x3F, 0x03, 0xF2, 0x3F, 0x33, 0xF5, 0x3F, 0xC3, 0xFC, 0x3F, 0xC3, 0xFC, 0x3F, 0xC0, 0x00,
    4, _NON_AUTOINC, 0x67, 0x88,
    4, _NON_AUTOINC, 0x66, 0x7E,
    4, _NON_AUTOINC, 0x67, 0x90,
    12, _NON_AUTOINC, 0x66, 0x3F,0xC3,0xFC,0x3F,0xC3,0xFC,0x3F,0xC0,0x00,

    4, _NON_AUTOINC, 0x67, 0xA0,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x6F, 0x09, 0x60, 0xB2, 0x0C, 0xA0, 0xE0, 0x0F, 0x11, 0x01, 0x10, 0xF1, 0x1C, 0x12, 0x71, 0x35, 0x13, 0xF1, 0x4B, 0x15, 0x41, 0x5F, 0x16, 0x71, 0x70, 0x17, 0x91, 0x82, 0x18, 0x91, 0x91, 0x19, 0x91, 0x9F, 0x1A, 0x71, 0xAF, 0x1B, 0x51, 0xBC, 0x1C, 0x21, 0xC9, 0x1D, 0x01, 0xD5, 0x1D, 0xA1, 0xE1, 0x1E, 0x61, 0xEA, 0x1E, 0xD1, 0xF2, 0x1F, 0x91, 0xFF, 0x20, 0x52, 0x0A, 0x20, 0xF2, 0x13, 0x21, 0x92, 0x1C, 0x22, 0x12, 0x26, 0x22, 0xC2, 0x2F, 0x23, 0x32, 0x37, 0x23, 0xD2, 0x41, 0x24, 0x42, 0x48, 0x24, 0xD2, 0x51, 0x25, 0x52, 0x5A, 0x25, 0xE2, 0x61, 0x26, 0x62, 0x69, 0x26, 0xC2, 0x70, 0x27, 0x32, 0x76, 0x27, 0x92, 0x7C, 0x28, 0x02, 0x83, 0x28, 0x62, 0x89, 0x28, 0xC2, 0x90, 0x29, 0x32, 0x96, 0x29, 0x92, 0x9B, 0x29, 0xF2, 0xA2, 0x2A, 0x52, 0xA8, 0x2A, 0xA2, 0xAD, 0x2B, 0x02, 0xB3, 0x2B, 0x62, 0xB9, 0x2B, 0xC2, 0xBF, 0x2C, 0x22, 0xC6, 0x2C, 0xA2, 0xCE, 0x2D, 0x22, 0xD5, 0x2D, 0x82, 0xDB, 0x2D, 0xF2, 0xE2, 0x2E, 0x52, 0xE8, 0x2E, 0xB2, 0xEE, 0x2F, 0x12, 0xF3, 0x2F, 0x52, 0xF7, 0x2F, 0xA2, 0xFD, 0x30, 0x03, 0x02, 0x30, 0x53, 0x07, 0x30, 0xA3, 0x0D, 0x30, 0xF3, 0x11, 0x31, 0x23, 0x14, 0x31, 0x63, 0x17, 0x31, 0x93, 0x1B, 0x31, 0xD3, 0x1E, 0x32, 0x03, 0x23, 0x32, 0x63, 0x28, 0x32, 0xB3, 0x2D, 0x32, 0xE3, 0x30, 0x33, 0x23, 0x33, 0x33, 0x53, 0x36, 0x33, 0x73, 0x38, 0x33, 0xA3, 0x3C, 0x33, 0xD3, 0x3F, 0x34, 0x13, 0x43, 0x34, 0x53, 0x47, 0x34, 0x83, 0x4A, 0x34, 0xC3, 0x4D, 0x34, 0xF3, 0x50, 0x35, 0x23, 0x53, 0x35, 0x43, 0x56, 0x35, 0x93, 0x5B, 0x35, 0xD3, 0x5F, 0x36, 0x13, 0x64, 0x36, 0x73, 0x69,
    138, _NON_AUTOINC, 0x66, 0x36, 0xA3, 0x6C, 0x36, 0xD3, 0x6E, 0x37, 0x03, 0x72, 0x37, 0x53, 0x76, 0x37, 0x73, 0x79, 0x37, 0xA3, 0x7B, 0x37, 0xD3, 0x7E, 0x38, 0x03, 0x81, 0x38, 0x23, 0x84, 0x38, 0x63, 0x88, 0x38, 0xA3, 0x8B, 0x38, 0xD3, 0x8E, 0x38, 0xF3, 0x91, 0x39, 0x23, 0x93, 0x39, 0x53, 0x96, 0x39, 0x83, 0x9A, 0x39, 0xD3, 0x9E, 0x3A, 0x03, 0xA1, 0x3A, 0x33, 0xA4, 0x3A, 0x73, 0xA9, 0x3A, 0xA3, 0xAB, 0x3A, 0xC3, 0xAE, 0x3B, 0x13, 0xB2, 0x3B, 0x43, 0xB7, 0x3B, 0xB3, 0xBD, 0x3B, 0xE3, 0xC0, 0x3C, 0x13, 0xC2, 0x3C, 0x33, 0xC5, 0x3C, 0x73, 0xC8, 0x3C, 0x93, 0xCA, 0x3C, 0xB3, 0xCC, 0x3C, 0xD3, 0xCD, 0x3C, 0xE3, 0xCF, 0x3D, 0x03, 0xD1, 0x3D, 0x23, 0xD2, 0x3D, 0x33, 0xD4, 0x3D, 0x53, 0xD6, 0x3D, 0x63, 0xD7, 0x3D, 0x83, 0xD9, 0x3D, 0xA3, 0xDB, 0x3D, 0xC3, 0xDD, 0x3D, 0xE3, 0xE0, 0x3F, 0xC3, 0xFC, 0x3F, 0xC3, 0xFC, 0x3F, 0xC0, 0x00,
    4, _NON_AUTOINC, 0x67, 0x88,
    4, _NON_AUTOINC, 0x66, 0x7E,
    4, _NON_AUTOINC, 0x67, 0xA0,
    12, _NON_AUTOINC, 0x66, 0x3F,0xC3,0xFC,0x3F,0xC3,0xFC,0x3F,0xC0,0x00,
    4, _NON_AUTOINC, 0x67, 0x40,
    _END
};

BYTE code tOG_TEST_SETD[] =
{
    4, _NON_AUTOINC, 0x9F, 0x00,
    4, _NON_AUTOINC, 0x67, 0x80,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x04, 0x00, 0x80, 0x0C, 0x01, 0x00, 0x14, 0x01, 0x80, 0x1C, 0x02, 0x00, 0x24, 0x02, 0x80, 0x2C, 0x03, 0x00, 0x34, 0x03, 0x80, 0x3C, 0x04, 0x00, 0x44, 0x04, 0x80, 0x4C, 0x05, 0x00, 0x54, 0x05, 0x80, 0x5C, 0x06, 0x00, 0x64, 0x06, 0x80, 0x6C, 0x07, 0x00, 0x74, 0x07, 0x80, 0x7C, 0x08, 0x00, 0x84, 0x08, 0x80, 0x8C, 0x09, 0x00, 0x94, 0x09, 0x80, 0x9C, 0x0A, 0x00, 0xA4, 0x0A, 0x80, 0xAC, 0x0B, 0x00, 0xB4, 0x0B, 0x80, 0xBC, 0x0C, 0x00, 0xC4, 0x0C, 0x80, 0xCC, 0x0D, 0x00, 0xD4, 0x0D, 0x80, 0xDC, 0x0E, 0x00, 0xE4, 0x0E, 0x80, 0xEC, 0x0F, 0x00, 0xF4, 0x0F, 0x80, 0xFC, 0x10, 0x01, 0x04, 0x10, 0x81, 0x0C, 0x11, 0x01, 0x14, 0x11, 0x81, 0x1C, 0x12, 0x01, 0x24, 0x12, 0x81, 0x2C, 0x13, 0x01, 0x34, 0x13, 0x81, 0x3C, 0x14, 0x01, 0x44, 0x14, 0x81, 0x4C, 0x15, 0x01, 0x54, 0x15, 0x81, 0x5C, 0x16, 0x01, 0x64, 0x16, 0x81, 0x6C, 0x17, 0x01, 0x74, 0x17, 0x81, 0x7C, 0x18, 0x01, 0x84, 0x18, 0x81, 0x8C, 0x19, 0x01, 0x94, 0x19, 0x81, 0x9C, 0x1A, 0x01, 0xA4, 0x1A, 0x81, 0xAC, 0x1B, 0x01, 0xB4, 0x1B, 0x81, 0xBC, 0x1C, 0x01, 0xC4, 0x1C, 0x81, 0xCC, 0x1D, 0x01, 0xD4, 0x1D, 0x81, 0xDC, 0x1E, 0x01, 0xE4, 0x1E, 0x81, 0xEC, 0x1F, 0x01, 0xF4, 0x1F, 0x81, 0xFC, 0x20, 0x02, 0x04, 0x20, 0x82, 0x0C, 0x21, 0x02, 0x14, 0x21, 0x82, 0x1C, 0x22, 0x02, 0x24, 0x22, 0x82, 0x2C, 0x23, 0x02, 0x34, 0x23, 0x82, 0x3C, 0x24, 0x02, 0x44, 0x24, 0x82, 0x4C, 0x25, 0x02, 0x54, 0x25, 0x82, 0x5C, 0x26, 0x02, 0x64, 0x26, 0x82, 0x6C, 0x27, 0x02, 0x74, 0x27, 0x82, 0x7C, 0x28, 0x02, 0x84, 0x28, 0x82, 0x8C, 0x29, 0x02, 0x94, 0x29, 0x82, 0x9C,
    138, _NON_AUTOINC, 0x66, 0x2A, 0x02, 0xA4, 0x2A, 0x82, 0xAC, 0x2B, 0x02, 0xB4, 0x2B, 0x82, 0xBC, 0x2C, 0x02, 0xC4, 0x2C, 0x82, 0xCC, 0x2D, 0x02, 0xD4, 0x2D, 0x82, 0xDC, 0x2E, 0x02, 0xE4, 0x2E, 0x82, 0xEC, 0x2F, 0x02, 0xF4, 0x2F, 0x82, 0xFC, 0x30, 0x03, 0x04, 0x30, 0x83, 0x0C, 0x31, 0x03, 0x14, 0x31, 0x83, 0x1C, 0x32, 0x03, 0x24, 0x32, 0x83, 0x2C, 0x33, 0x03, 0x34, 0x33, 0x83, 0x3C, 0x34, 0x03, 0x44, 0x34, 0x83, 0x4C, 0x35, 0x03, 0x54, 0x35, 0x83, 0x5C, 0x36, 0x03, 0x64, 0x36, 0x83, 0x6C, 0x37, 0x03, 0x74, 0x37, 0x83, 0x7C, 0x38, 0x03, 0x84, 0x38, 0x83, 0x8C, 0x39, 0x03, 0x94, 0x39, 0x83, 0x9C, 0x3A, 0x03, 0xA4, 0x3A, 0x83, 0xAC, 0x3B, 0x03, 0xB4, 0x3B, 0x83, 0xBC, 0x3C, 0x03, 0xC4, 0x3C, 0x83, 0xCC, 0x3D, 0x03, 0xD4, 0x3D, 0x83, 0xDC, 0x3E, 0x03, 0xE4, 0x3E, 0x83, 0xEC, 0x3F, 0x03, 0xF4, 0x3F, 0x83, 0xFC, 0x3F, 0xC0, 0x00,

    4, _NON_AUTOINC, 0x67, 0x90,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x04, 0x00, 0x80, 0x0C, 0x01, 0x00, 0x14, 0x01, 0x80, 0x1C, 0x02, 0x00, 0x24, 0x02, 0x80, 0x2C, 0x03, 0x00, 0x34, 0x03, 0x80, 0x3C, 0x04, 0x00, 0x44, 0x04, 0x80, 0x4C, 0x05, 0x00, 0x54, 0x05, 0x80, 0x5C, 0x06, 0x00, 0x64, 0x06, 0x80, 0x6C, 0x07, 0x00, 0x74, 0x07, 0x80, 0x7C, 0x08, 0x00, 0x84, 0x08, 0x80, 0x8C, 0x09, 0x00, 0x94, 0x09, 0x80, 0x9C, 0x0A, 0x00, 0xA4, 0x0A, 0x80, 0xAC, 0x0B, 0x00, 0xB4, 0x0B, 0x80, 0xBC, 0x0C, 0x00, 0xC4, 0x0C, 0x80, 0xCC, 0x0D, 0x00, 0xD4, 0x0D, 0x80, 0xDC, 0x0E, 0x00, 0xE4, 0x0E, 0x80, 0xEC, 0x0F, 0x00, 0xF4, 0x0F, 0x80, 0xFC, 0x10, 0x01, 0x04, 0x10, 0x81, 0x0C, 0x11, 0x01, 0x14, 0x11, 0x81, 0x1C, 0x12, 0x01, 0x24, 0x12, 0x81, 0x2C, 0x13, 0x01, 0x34, 0x13, 0x81, 0x3C, 0x14, 0x01, 0x44, 0x14, 0x81, 0x4C, 0x15, 0x01, 0x54, 0x15, 0x81, 0x5C, 0x16, 0x01, 0x64, 0x16, 0x81, 0x6C, 0x17, 0x01, 0x74, 0x17, 0x81, 0x7C, 0x18, 0x01, 0x84, 0x18, 0x81, 0x8C, 0x19, 0x01, 0x94, 0x19, 0x81, 0x9C, 0x1A, 0x01, 0xA4, 0x1A, 0x81, 0xAC, 0x1B, 0x01, 0xB4, 0x1B, 0x81, 0xBC, 0x1C, 0x01, 0xC4, 0x1C, 0x81, 0xCC, 0x1D, 0x01, 0xD4, 0x1D, 0x81, 0xDC, 0x1E, 0x01, 0xE4, 0x1E, 0x81, 0xEC, 0x1F, 0x01, 0xF4, 0x1F, 0x81, 0xFC, 0x20, 0x02, 0x04, 0x20, 0x82, 0x0C, 0x21, 0x02, 0x14, 0x21, 0x82, 0x1C, 0x22, 0x02, 0x24, 0x22, 0x82, 0x2C, 0x23, 0x02, 0x34, 0x23, 0x82, 0x3C, 0x24, 0x02, 0x44, 0x24, 0x82, 0x4C, 0x25, 0x02, 0x54, 0x25, 0x82, 0x5C, 0x26, 0x02, 0x64, 0x26, 0x82, 0x6C, 0x27, 0x02, 0x74, 0x27, 0x82, 0x7C, 0x28, 0x02, 0x84, 0x28, 0x82, 0x8C, 0x29, 0x02, 0x94, 0x29, 0x82, 0x9C,
    138, _NON_AUTOINC, 0x66, 0x2A, 0x02, 0xA4, 0x2A, 0x82, 0xAC, 0x2B, 0x02, 0xB4, 0x2B, 0x82, 0xBC, 0x2C, 0x02, 0xC4, 0x2C, 0x82, 0xCC, 0x2D, 0x02, 0xD4, 0x2D, 0x82, 0xDC, 0x2E, 0x02, 0xE4, 0x2E, 0x82, 0xEC, 0x2F, 0x02, 0xF4, 0x2F, 0x82, 0xFC, 0x30, 0x03, 0x04, 0x30, 0x83, 0x0C, 0x31, 0x03, 0x14, 0x31, 0x83, 0x1C, 0x32, 0x03, 0x24, 0x32, 0x83, 0x2C, 0x33, 0x03, 0x34, 0x33, 0x83, 0x3C, 0x34, 0x03, 0x44, 0x34, 0x83, 0x4C, 0x35, 0x03, 0x54, 0x35, 0x83, 0x5C, 0x36, 0x03, 0x64, 0x36, 0x83, 0x6C, 0x37, 0x03, 0x74, 0x37, 0x83, 0x7C, 0x38, 0x03, 0x84, 0x38, 0x83, 0x8C, 0x39, 0x03, 0x94, 0x39, 0x83, 0x9C, 0x3A, 0x03, 0xA4, 0x3A, 0x83, 0xAC, 0x3B, 0x03, 0xB4, 0x3B, 0x83, 0xBC, 0x3C, 0x03, 0xC4, 0x3C, 0x83, 0xCC, 0x3D, 0x03, 0xD4, 0x3D, 0x83, 0xDC, 0x3E, 0x03, 0xE4, 0x3E, 0x83, 0xEC, 0x3F, 0x03, 0xF4, 0x3F, 0x83, 0xFC, 0x3F, 0xC0, 0x00,

    4, _NON_AUTOINC, 0x67, 0xA0,
    255, _NON_AUTOINC, 0x66, 0x00, 0x00, 0x04, 0x00, 0x80, 0x0C, 0x01, 0x00, 0x14, 0x01, 0x80, 0x1C, 0x02, 0x00, 0x24, 0x02, 0x80, 0x2C, 0x03, 0x00, 0x34, 0x03, 0x80, 0x3C, 0x04, 0x00, 0x44, 0x04, 0x80, 0x4C, 0x05, 0x00, 0x54, 0x05, 0x80, 0x5C, 0x06, 0x00, 0x64, 0x06, 0x80, 0x6C, 0x07, 0x00, 0x74, 0x07, 0x80, 0x7C, 0x08, 0x00, 0x84, 0x08, 0x80, 0x8C, 0x09, 0x00, 0x94, 0x09, 0x80, 0x9C, 0x0A, 0x00, 0xA4, 0x0A, 0x80, 0xAC, 0x0B, 0x00, 0xB4, 0x0B, 0x80, 0xBC, 0x0C, 0x00, 0xC4, 0x0C, 0x80, 0xCC, 0x0D, 0x00, 0xD4, 0x0D, 0x80, 0xDC, 0x0E, 0x00, 0xE4, 0x0E, 0x80, 0xEC, 0x0F, 0x00, 0xF4, 0x0F, 0x80, 0xFC, 0x10, 0x01, 0x04, 0x10, 0x81, 0x0C, 0x11, 0x01, 0x14, 0x11, 0x81, 0x1C, 0x12, 0x01, 0x24, 0x12, 0x81, 0x2C, 0x13, 0x01, 0x34, 0x13, 0x81, 0x3C, 0x14, 0x01, 0x44, 0x14, 0x81, 0x4C, 0x15, 0x01, 0x54, 0x15, 0x81, 0x5C, 0x16, 0x01, 0x64, 0x16, 0x81, 0x6C, 0x17, 0x01, 0x74, 0x17, 0x81, 0x7C, 0x18, 0x01, 0x84, 0x18, 0x81, 0x8C, 0x19, 0x01, 0x94, 0x19, 0x81, 0x9C, 0x1A, 0x01, 0xA4, 0x1A, 0x81, 0xAC, 0x1B, 0x01, 0xB4, 0x1B, 0x81, 0xBC, 0x1C, 0x01, 0xC4, 0x1C, 0x81, 0xCC, 0x1D, 0x01, 0xD4, 0x1D, 0x81, 0xDC, 0x1E, 0x01, 0xE4, 0x1E, 0x81, 0xEC, 0x1F, 0x01, 0xF4, 0x1F, 0x81, 0xFC, 0x20, 0x02, 0x04, 0x20, 0x82, 0x0C, 0x21, 0x02, 0x14, 0x21, 0x82, 0x1C, 0x22, 0x02, 0x24, 0x22, 0x82, 0x2C, 0x23, 0x02, 0x34, 0x23, 0x82, 0x3C, 0x24, 0x02, 0x44, 0x24, 0x82, 0x4C, 0x25, 0x02, 0x54, 0x25, 0x82, 0x5C, 0x26, 0x02, 0x64, 0x26, 0x82, 0x6C, 0x27, 0x02, 0x74, 0x27, 0x82, 0x7C, 0x28, 0x02, 0x84, 0x28, 0x82, 0x8C, 0x29, 0x02, 0x94, 0x29, 0x82, 0x9C,
    138, _NON_AUTOINC, 0x66, 0x2A, 0x02, 0xA4, 0x2A, 0x82, 0xAC, 0x2B, 0x02, 0xB4, 0x2B, 0x82, 0xBC, 0x2C, 0x02, 0xC4, 0x2C, 0x82, 0xCC, 0x2D, 0x02, 0xD4, 0x2D, 0x82, 0xDC, 0x2E, 0x02, 0xE4, 0x2E, 0x82, 0xEC, 0x2F, 0x02, 0xF4, 0x2F, 0x82, 0xFC, 0x30, 0x03, 0x04, 0x30, 0x83, 0x0C, 0x31, 0x03, 0x14, 0x31, 0x83, 0x1C, 0x32, 0x03, 0x24, 0x32, 0x83, 0x2C, 0x33, 0x03, 0x34, 0x33, 0x83, 0x3C, 0x34, 0x03, 0x44, 0x34, 0x83, 0x4C, 0x35, 0x03, 0x54, 0x35, 0x83, 0x5C, 0x36, 0x03, 0x64, 0x36, 0x83, 0x6C, 0x37, 0x03, 0x74, 0x37, 0x83, 0x7C, 0x38, 0x03, 0x84, 0x38, 0x83, 0x8C, 0x39, 0x03, 0x94, 0x39, 0x83, 0x9C, 0x3A, 0x03, 0xA4, 0x3A, 0x83, 0xAC, 0x3B, 0x03, 0xB4, 0x3B, 0x83, 0xBC, 0x3C, 0x03, 0xC4, 0x3C, 0x83, 0xCC, 0x3D, 0x03, 0xD4, 0x3D, 0x83, 0xDC, 0x3E, 0x03, 0xE4, 0x3E, 0x83, 0xEC, 0x3F, 0x03, 0xF4, 0x3F, 0x83, 0xFC, 0x3F, 0xC0, 0x00,
    4, _NON_AUTOINC, 0x67, 0x40,
    _END
};

// -----------CRC Table of output Gamma, 1680x1050--------
BYTE code tOG_CRC_MODE0[] =
{
    0x41, 0xf9, 0x6d, 0x5f, 0xdc, 0x63,
    _END
};

BYTE code tOG_CRC_MODE1[] =
{
    0x86, 0x34, 0x8d, 0x89, 0xb8, 0x77,
    _END
};

BYTE code tOG_CRC_MODE2[] =
{
    0x23, 0x49, 0x42, 0x2e, 0x53, 0x79,
    _END
};

BYTE code tOG_CRC_MODE3[] =
{
    0xa1, 0xc6, 0x15, 0xd5, 0xa6, 0x67,
    _END
};

BYTE code tOG_CRC_MODE4[] =
{
    0x5b, 0x25, 0xf5, 0x74, 0x94, 0x3f,
    _END
};

BYTE code tOG_CRC_MODE5[] =
{
    0x9a, 0x79, 0x86, 0xa3, 0x2e, 0x92,
    _END
};

BYTE code tBACKGROUND_COLOR_CRC[] =
{
    0x87, 0xAA, 0xAE, 0x00, 0x00, 0x00,
};

//--------------------------------------------------
// Code Tables of DCR Setting
//--------------------------------------------------
BYTE code tQC_D_DOMAIN_DCR_RESULT_TABLE_0[]=
{
    0x1a, 0xe8, 0x37, 0x28, 0x46, 0xd4, 0xba, 0x0d, 0x6d, 0x4d,
    0x19, 0x91, 0x1d, 0xff, 0xb3, 0x4d, 0xac, 0x3f, 0xff, 0x00,
    0xb3, 0x4c, 0xac, 0x4b, 0xff, 0x00, 0xb3, 0x4c, 0xac, 0x45,
    0xff, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xfe, 0x00,
};

BYTE code tQC_D_DOMAIN_DCR_RESULT_TABLE_1[]=
{
    0x19, 0x23, 0xe8, 0x0d, 0x5e, 0xb4, 0x6b, 0x0b, 0xb2, 0xe1,
    0x09, 0x24, 0x85, 0x9a, 0xb3, 0x4d, 0xac, 0x3f, 0xff, 0x00,
    0xb3, 0x4c, 0xac, 0x4b, 0xff, 0x00, 0xb3, 0x4c, 0xac, 0x45,
    0xff, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xfe, 0x00,
};

BYTE code tQC_D_DOMAIN_DCR_RESULT_TABLE_2[]=
{
    0x00, 0x5d, 0x69, 0x00, 0x59, 0xf6, 0xdf, 0x02, 0xf2, 0xb3,
    0x02, 0x1a, 0x16, 0xae, 0x52, 0xed, 0x52, 0xad, 0xff, 0x00,
    0x53, 0x0e, 0x52, 0xc7, 0xff, 0x00, 0x53, 0x21, 0x52, 0xd8,
    0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0x00,
};

BYTE code tQC_D_DOMAIN_DCR_RESULT_TABLE_3[]=
{
    0x15, 0x33, 0x90, 0x0a, 0x94, 0x40, 0xa6, 0x00, 0x16, 0x07,
    0x00, 0x15, 0xf0, 0xf9, 0x57, 0xc8, 0x50, 0xc8, 0xff, 0x00,
    0x57, 0x57, 0x50, 0x9a, 0xff, 0x00, 0x57, 0xb2, 0x50, 0xbe,
    0xff, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xfe, 0x00,
};

BYTE code tQC_D_DOMAIN_DCR_RESULT_TABLE_4[]=
{
    0x04, 0xec, 0x6b, 0x14, 0xa2, 0x05, 0xae, 0x04, 0xab, 0xd8,
    0x14, 0x43, 0x6b, 0x7b, 0x68, 0x3a, 0x5a, 0x91, 0xff, 0x00,
    0x6f, 0xef, 0x5b, 0xe5, 0xff, 0x00, 0x64, 0xbd, 0x59, 0xed,
    0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0x00,
};

//--------------------------------------------------
// Code Tables of DCC CRC
//--------------------------------------------------
BYTE code tQC_DCC_CRC_TABLE0[] = {
    0x57, 0x74, 0xFB, 0xE7, 0xE0, 0xCB,
};

BYTE code tQC_DCC_CRC_TABLE1[] = {
    0x5A, 0x30, 0x65, 0x88, 0xAE, 0x44,
};

BYTE code tQC_DCC_CRC_TABLE2[] = {
    0x74, 0x17, 0x6F, 0x24, 0x95, 0xE5,
};

BYTE code tQC_DCC_CRC_TABLE3[] = {
    0x6E, 0x18, 0xB1, 0x3A, 0xCE, 0xD0,
};

BYTE code tQC_DCC_CRC_TABLE4[] = {
    0xE9, 0x8B, 0x09, 0x66, 0xD4, 0x66,
};

BYTE code tQC_DCC_CRC_TABLE5[] = {
    0x8C, 0x46, 0x16, 0xFA, 0x27, 0xBB,
};

BYTE code tQC_DCC_CRC_TABLE6[] = {
    0xEC, 0x04, 0x51, 0xC9, 0x6F, 0x94,
};

BYTE code tQC_DCC_CRC_TABLE7[] = {
    0x60, 0x9A, 0x66, 0x02, 0x1C, 0xCA,
};

//--------------------------------------------------
// Code Tables of DCC Setting
//--------------------------------------------------
BYTE code tQC_DCC_SETTING0[] =
{
    //---------Dcc-------------
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC8, 0xA0,
    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC9, 0x00,
    6, _NON_AUTOINC, 0xCA, 0x00, 0x02, 0x5E,

    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC9, 0x06,
    6, _NON_AUTOINC, 0xCA, 0xB4, 0xF0, 0x10,

    4, _NON_AUTOINC, 0xC7, 0xE1,
    4, _NON_AUTOINC, 0xC9, 0x00,
    19, _NON_AUTOINC, 0xCA, 0x05, 0x0E, 0x1A, 0x28, 0x3B, 0x51, 0x68, 0x80, 0x9A, 0xB3, 0xC6, 0xD6, 0xE4, 0xEF, 0xF8, 0x00,

    4, _NON_AUTOINC, 0xC7, 0xE1,
    4, _NON_AUTOINC, 0xC9, 0x12,
    4, _NON_AUTOINC, 0xCA, 0x10,
    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC9, 0x00,

    _END
};

BYTE code tQC_DCC_SETTING1[] =
{
    //---------Dcc-------------
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xC7, 0x80,
    4, _NON_AUTOINC, 0xC8, 0x80,
    4, _NON_AUTOINC, 0xC7, 0x80,
    4, _NON_AUTOINC, 0xC9, 0x00,
    6, _NON_AUTOINC, 0xCA, 0x00, 0x3A, 0x01,

    4, _NON_AUTOINC, 0xC7, 0x80,
    4, _NON_AUTOINC, 0xC9, 0x06,
    6, _NON_AUTOINC, 0xCA, 0xB4, 0x00, 0xFF,

    4, _NON_AUTOINC, 0xC7, 0x81,
    4, _NON_AUTOINC, 0xC9, 0x00,
    19, _NON_AUTOINC, 0xCA, 0x26, 0x41, 0x57, 0x6A, 0x7C, 0x8D, 0x9B, 0xAB, 0xB7, 0xC4, 0xD1, 0xDC, 0xE6, 0xEF, 0xF8, 0x00,

    4, _NON_AUTOINC, 0xC7, 0x81,
    4, _NON_AUTOINC, 0xC9, 0x12,
    4, _NON_AUTOINC, 0xCA, 0x10,
    4, _NON_AUTOINC, 0xC7, 0x80,
    4, _NON_AUTOINC, 0xC9, 0x00,

    _END
};

BYTE code tQC_DCC_SETTING2[] =
{
    //---------Dcc-------------
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xC7, 0xA0,
    4, _NON_AUTOINC, 0xC8, 0x80,
    4, _NON_AUTOINC, 0xC7, 0xA0,
    4, _NON_AUTOINC, 0xC9, 0x00,
    6, _NON_AUTOINC, 0xCA, 0x00, 0x06, 0xF7,

    4, _NON_AUTOINC, 0xC7, 0xA0,
    4, _NON_AUTOINC, 0xC9, 0x06,
    6, _NON_AUTOINC, 0xCA, 0x4B, 0xC4, 0x3C,

    4, _NON_AUTOINC, 0xC7, 0xA1,
    4, _NON_AUTOINC, 0xC9, 0x00,
    19, _NON_AUTOINC, 0xCA, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x80, 0xF3, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB,

    4, _NON_AUTOINC, 0xC7, 0xA1,
    4, _NON_AUTOINC, 0xC9, 0x12,
    4, _NON_AUTOINC, 0xCA, 0x00,
    4, _NON_AUTOINC, 0xC7, 0xA0,
    4, _NON_AUTOINC, 0xC9, 0x00,

    _END
};

BYTE code tQC_DCC_SETTING3[] =
{
    //---------Dcc-------------
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xC7, 0xC0,
    4, _NON_AUTOINC, 0xC8, 0xA0,
    4, _NON_AUTOINC, 0xC7, 0xC0,
    4, _NON_AUTOINC, 0xC9, 0x00,
    6, _NON_AUTOINC, 0xCA, 0x00, 0x02, 0x78,

    4, _NON_AUTOINC, 0xC7, 0xC0,
    4, _NON_AUTOINC, 0xC9, 0x06,
    6, _NON_AUTOINC, 0xCA, 0xB4, 0x0F, 0xEF,

    4, _NON_AUTOINC, 0xC7, 0xC1,
    4, _NON_AUTOINC, 0xC9, 0x00,
    19, _NON_AUTOINC, 0xCA, 0x05, 0x0A, 0x11, 0x19, 0x22, 0x2D, 0x37, 0x43, 0x50, 0x5D, 0x6C, 0x7F, 0x96, 0xB1, 0xD1, 0x00,

    4, _NON_AUTOINC, 0xC7, 0xC1,
    4, _NON_AUTOINC, 0xC9, 0x12,
    4, _NON_AUTOINC, 0xCA, 0x0F,
    4, _NON_AUTOINC, 0xC7, 0xC0,
    4, _NON_AUTOINC, 0xC9, 0x00,

    _END
};

BYTE code tQC_DCC_SETTING4[] =
{
    //---------Dcc-------------
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC8, 0xA0,
    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC9, 0x00,
    6, _NON_AUTOINC, 0xCA, 0x00, 0x03, 0x96,

    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC9, 0x06,
    6, _NON_AUTOINC, 0xCA, 0x96, 0xFA, 0x05,

    4, _NON_AUTOINC, 0xC7, 0xE1,
    4, _NON_AUTOINC, 0xC9, 0x00,
    19, _NON_AUTOINC, 0xCA, 0x25, 0x3C, 0x4D, 0x5D, 0x67, 0x71, 0x79, 0x80, 0x87, 0x90, 0x99, 0xA5, 0xB4, 0xC7, 0xDB, 0xFA,

    4, _NON_AUTOINC, 0xC7, 0xE1,
    4, _NON_AUTOINC, 0xC9, 0x12,
    4, _NON_AUTOINC, 0xCA, 0x1F,
    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC9, 0x00,

    _END
};

BYTE code tQC_DCC_SETTING5[] =
{
    //---------Dcc-------------
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xC7, 0xA0,
    4, _NON_AUTOINC, 0xC8, 0xA0,
    4, _NON_AUTOINC, 0xC7, 0xA0,
    4, _NON_AUTOINC, 0xC9, 0x00,
    6, _NON_AUTOINC, 0xCA, 0x00, 0x02, 0x5E,

    4, _NON_AUTOINC, 0xC7, 0xA0,
    4, _NON_AUTOINC, 0xC9, 0x06,
    6, _NON_AUTOINC, 0xCA, 0xB4, 0xC4, 0x40,

    4, _NON_AUTOINC, 0xC7, 0xA1,
    4, _NON_AUTOINC, 0xC9, 0x00,
    19, _NON_AUTOINC, 0xCA, 0x25, 0x3C, 0x4D, 0x5D, 0x67, 0x71, 0x79, 0x80, 0x87, 0x90, 0x99, 0xA5, 0xB4, 0xC7, 0xDB, 0xFA,

    4, _NON_AUTOINC, 0xC7, 0xA1,
    4, _NON_AUTOINC, 0xC9, 0x12,
    4, _NON_AUTOINC, 0xCA, 0x0F,
    4, _NON_AUTOINC, 0xC7, 0xA0,
    4, _NON_AUTOINC, 0xC9, 0x00,

    _END
};

BYTE code tQC_DCC_SETTING6[] =
{
    //---------Dcc-------------
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC8, 0xA0,
    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC9, 0x00,
    6, _NON_AUTOINC, 0xCA, 0x00, 0x02, 0x5E,

    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC9, 0x06,
    6, _NON_AUTOINC, 0xCA, 0x7B, 0xB4, 0x4B,

    4, _NON_AUTOINC, 0xC7, 0xE1,
    4, _NON_AUTOINC, 0xC9, 0x00,
    19, _NON_AUTOINC, 0xCA, 0x25, 0x3C, 0x4D, 0x5D, 0x67, 0x71, 0x79, 0x80, 0x87, 0x90, 0x99, 0xA5, 0xB4, 0xC7, 0xDB, 0xFA,

    4, _NON_AUTOINC, 0xC7, 0xE1,
    4, _NON_AUTOINC, 0xC9, 0x12,
    4, _NON_AUTOINC, 0xCA, 0x08,
    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC9, 0x00,

    _END
};

BYTE code tQC_DCC_SETTING7[] =
{
    //---------Dcc-------------
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC8, 0xA0,
    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC9, 0x00,
    6, _NON_AUTOINC, 0xCA, 0x00, 0x02, 0x5E,

    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC9, 0x06,
    6, _NON_AUTOINC, 0xCA, 0xA4, 0x00, 0xFF,

    4, _NON_AUTOINC, 0xC7, 0xE1,
    4, _NON_AUTOINC, 0xC9, 0x00,
    19, _NON_AUTOINC, 0xCA, 0x25, 0x3C, 0x4D, 0x5D, 0x67, 0x71, 0x79, 0x80, 0x87, 0x90, 0x99, 0xA5, 0xB4, 0xC7, 0xDB, 0xFA,

    4, _NON_AUTOINC, 0xC7, 0xE1,
    4, _NON_AUTOINC, 0xC9, 0x12,
    4, _NON_AUTOINC, 0xCA, 0x07,
    4, _NON_AUTOINC, 0xC7, 0xE0,
    4, _NON_AUTOINC, 0xC9, 0x00,

    _END
};

//--------------------------------------------------
// Code Tables of ICM CRC
//--------------------------------------------------
BYTE code tQC_ICM_CRC_TABLE0[] = {
    0x1B, 0x1D, 0x43, 0xCD, 0xF4, 0x3E,
};

BYTE code tQC_ICM_CRC_TABLE1[] = {
    0x6A, 0xF1, 0x25, 0x5C, 0xEA, 0x18,
};

BYTE code tQC_ICM_CRC_TABLE2[] = {
    0x0A, 0x1A, 0x49, 0x07, 0x68, 0x23,
};

BYTE code tQC_ICM_CRC_TABLE3[] = {
    0x91, 0x04, 0xE7, 0x62, 0x1F, 0x1A,
};

BYTE code tQC_ICM_CRC_TABLE4[] = {
    0xDA, 0xCA, 0x2B, 0x35, 0xE7, 0x37,
};

BYTE code tQC_ICM_CRC_TABLE5[] = {
    0x79, 0xA1, 0xA1, 0xFD, 0x96, 0x4D,
};

BYTE code tQC_ICM_CRC_TABLE6[] = {
    0xFA, 0x25, 0xBE, 0x2F, 0x09, 0xE3,
};

BYTE code tQC_ICM_CRC_TABLE7[] = {
    0xD3, 0xCB, 0x1A, 0x51, 0xF3, 0x46,
};

BYTE code tQC_ICM_CRC_TABLE8[] = {
    0x9B, 0x0E, 0xA5, 0x36, 0xB7, 0x9C,
};

BYTE code tQC_ICM_CRC_TABLE9[] = {
    0x2C, 0x8B, 0xCE, 0xB3, 0xA6, 0x99,
};

//--------------------------------------------------
// Code Tables of ICM Setting
//--------------------------------------------------
BYTE code tQC_ICM_SETTING0[] =
{
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xD0, 0xFF,
    4, _NON_AUTOINC, 0xD1, 0x08,
    4, _NON_AUTOINC, 0xD1, 0x08,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x00, 0xD4, 0x01, 0xA8, 0x01, 0x80, 0x01, 0x80, 0x02, 0x80, 0x02, 0x80, 0x02, 0x80, 0x03, 0x80, 0xF6, 0xD4, 0xEC, 0xA9, 0xE2, 0x80, 0xD8, 0x80, 0xCE, 0x80, 0xC4, 0x80, 0xB9, 0x80, 0xB0, 0x80, 0x0B, 0xD4, 0x16, 0xA9, 0x21, 0x80, 0x2D, 0x80, 0x38, 0x80, 0x43, 0x80, 0x4E, 0x80, 0x59, 0x80, 0xEB, 0xD5, 0xD5, 0xAB, 0xC0, 0x80, 0xAB, 0x80, 0x95, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x17, 0xD2, 0x2E, 0xA5, 0x45, 0x80, 0x5C, 0x80, 0x72, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x06, 0x94, 0x07, 0x3C, 0x05, 0xEB, 0x07, 0xF8, 0x03, 0xFB, 0x00, 0x00, 0x00, 0x82, 0x01, 0x04, 0x01, 0x8B, 0x02, 0xD2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

    4, _NON_AUTOINC, 0xD1, 0x09,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x28, 0xE7, 0x50, 0xCD, 0x78, 0xB4, 0x7F, 0x9B, 0x7F, 0x81, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x20, 0xDC, 0x40, 0xB9, 0x61, 0x95, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x2F, 0xF2, 0x5E, 0xE4, 0x7F, 0xD6, 0x7F, 0xC8, 0x7F, 0xBA, 0x7F, 0xAC, 0x7F, 0x9F, 0x7F, 0x92, 0x17, 0xD2, 0x2E, 0xA5, 0x45, 0x80, 0x5C, 0x80, 0x72, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x35, 0x00, 0x6B, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x00, 0x93, 0x02, 0x31, 0x0F, 0x02, 0x03, 0xFB, 0x0C, 0x05, 0x02, 0xD2, 0x00, 0x7F, 0x00, 0xFF, 0x01, 0x7F, 0x02, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

    4, _NON_AUTOINC, 0xD1, 0x0A,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x22, 0x22, 0x43, 0x44, 0x65, 0x66, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x2D, 0x11, 0x5B, 0x22, 0x7F, 0x32, 0x7F, 0x43, 0x7F, 0x54, 0x7F, 0x65, 0x7F, 0x75, 0x7F, 0x7F, 0x1A, 0x2B, 0x34, 0x55, 0x4E, 0x7F, 0x68, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x35, 0x00, 0x6B, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x15, 0x2B, 0x2B, 0x55, 0x40, 0x7F, 0x55, 0x7F, 0x6B, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x09, 0xE8, 0x0A, 0xF9, 0x09, 0x5F, 0x0C, 0x05, 0x08, 0x08, 0x05, 0x2E, 0x00, 0x9F, 0x01, 0x6B, 0x01, 0xD8, 0x02, 0xD2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

    4, _NON_AUTOINC, 0xD1, 0x0B,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x0C, 0x07, 0x19, 0x0F, 0x25, 0x16, 0x31, 0x1D, 0x3E, 0x25, 0x4A, 0x2C, 0x56, 0x33, 0x62, 0x3A, 0x0D, 0x06, 0x1A, 0x0C, 0x27, 0x12, 0x34, 0x18, 0x41, 0x1E, 0x4E, 0x23, 0x5B, 0x29, 0x68, 0x2F, 0x0B, 0x0B, 0x15, 0x16, 0x20, 0x21, 0x2A, 0x2C, 0x35, 0x36, 0x3F, 0x41, 0x4A, 0x4C, 0x54, 0x56, 0x10, 0x00, 0x20, 0x00, 0x30, 0x00, 0x40, 0x00, 0x50, 0x00, 0x60, 0x00, 0x70, 0x00, 0x7E, 0x00, 0x08, 0x10, 0x10, 0x20, 0x18, 0x30, 0x20, 0x40, 0x28, 0x50, 0x30, 0x60, 0x38, 0x70, 0x3F, 0x7E, 0x09, 0xDC, 0x09, 0x81, 0x0A, 0xBE, 0x08, 0x08, 0x0C, 0x05, 0x08, 0x00, 0x01, 0x15, 0x01, 0x5E, 0x02, 0x0A, 0x02, 0xD2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

    4, _NON_AUTOINC, 0xD1, 0x0C,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x01, 0x10, 0x02, 0x20, 0x03, 0x30, 0x05, 0x40, 0x06, 0x50, 0x07, 0x60, 0x08, 0x70, 0x09, 0x7E, 0x04, 0x10, 0x09, 0x20, 0x0D, 0x30, 0x11, 0x40, 0x16, 0x50, 0x1A, 0x60, 0x1F, 0x70, 0x23, 0x7E, 0xFE, 0x10, 0xFC, 0x20, 0xFA, 0x30, 0xF8, 0x40, 0xF6, 0x50, 0xF4, 0x60, 0xF2, 0x70, 0xF0, 0x7E, 0x08, 0x10, 0x10, 0x20, 0x18, 0x30, 0x20, 0x40, 0x28, 0x50, 0x30, 0x60, 0x38, 0x70, 0x3F, 0x7E, 0xF8, 0x10, 0xF0, 0x20, 0xE8, 0x30, 0xE0, 0x40, 0xD8, 0x50, 0xD0, 0x60, 0xC8, 0x70, 0xC1, 0x7E, 0x0F, 0x70, 0x0D, 0xD3, 0x01, 0x01, 0x0C, 0x05, 0x03, 0xFB, 0x0A, 0xD2, 0x00, 0x80, 0x01, 0x00, 0x01, 0x80, 0x02, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

    4, _NON_AUTOINC, 0xD1, 0x0D,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF1, 0x03, 0xE3, 0x05, 0xD4, 0x08, 0xC5, 0x0B, 0xB7, 0x0D, 0xA8, 0x10, 0x99, 0x13, 0x8C, 0x15, 0xF2, 0x05, 0xE5, 0x09, 0xD7, 0x0E, 0xC9, 0x13, 0xBC, 0x18, 0xAE, 0x1C, 0xA1, 0x21, 0x94, 0x26, 0xF0, 0x01, 0xE1, 0x01, 0xD1, 0x02, 0xC1, 0x02, 0xB1, 0x03, 0xA2, 0x03, 0x92, 0x04, 0x83, 0x04, 0xF8, 0x10, 0xF0, 0x20, 0xE8, 0x30, 0xE0, 0x40, 0xD8, 0x50, 0xD0, 0x60, 0xC8, 0x70, 0xC1, 0x7E, 0xF0, 0x00, 0xE0, 0x00, 0xD0, 0x00, 0xC0, 0x00, 0xB0, 0x00, 0xA0, 0x00, 0x90, 0x00, 0x82, 0x00, 0x07, 0x4C, 0x06, 0xCA, 0x07, 0xD6, 0x03, 0xFB, 0x07, 0xF8, 0x0D, 0x2E, 0x01, 0xF8, 0x02, 0x5C, 0x02, 0xBC, 0x02, 0xD2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    4, _NON_AUTOINC, 0xD1, 0x08,
    4, _NON_AUTOINC, 0xD2, 0x00,
    4, _NON_AUTOINC, 0xD4, 0x02,

    _END
};

BYTE code tQC_ICM_SETTING1[] =
{
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xD0, 0xDF,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x10, 0x20, 0x1F, 0x3F, 0x2F, 0x5F, 0x3F, 0x7E, 0x2F, 0x5F, 0x1F, 0x3F, 0x10, 0x20, 0x00, 0x00, 0x09, 0x0C, 0x13, 0x18, 0x1C, 0x24, 0x26, 0x31, 0x1C, 0x24, 0x13, 0x18, 0x09, 0x0C, 0x00, 0x00, 0x06, 0x15, 0x0B, 0x2A, 0x11, 0x3F, 0x17, 0x54, 0x11, 0x3F, 0x0B, 0x2A, 0x06, 0x15, 0x00, 0x00, 0x12, 0x10, 0x25, 0x20, 0x37, 0x30, 0x49, 0x40, 0x37, 0x30, 0x25, 0x20, 0x12, 0x10, 0x00, 0x00, 0x03, 0x24, 0x05, 0x48, 0x08, 0x6C, 0x0A, 0x7F, 0x08, 0x6C, 0x05, 0x48, 0x03, 0x24, 0x00, 0x00, 0x03, 0xFB, 0x04, 0xD8, 0x02, 0x2D, 0x05, 0x8E, 0x00, 0x90, 0x01, 0xD2, 0x00, 0x80, 0x01, 0x00, 0x01, 0x80, 0x02, 0x00, 0x87, 0x75, 0x01, 0xE0, 0x00, 0x36, 0x00, 0x1C,

    4, _NON_AUTOINC, 0xD1, 0x19,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF0, 0x35, 0xE1, 0x6A, 0xD1, 0x7F, 0xC1, 0x7F, 0xD1, 0x7F, 0xE1, 0x6A, 0xF0, 0x35, 0x00, 0x00, 0xFD, 0x1A, 0xFA, 0x35, 0xF7, 0x4F, 0xF4, 0x69, 0xF7, 0x4F, 0xFA, 0x35, 0xFD, 0x1A, 0x00, 0x00, 0xFE, 0x03, 0xFC, 0x06, 0xF9, 0x09, 0xF7, 0x0C, 0xF9, 0x09, 0xFC, 0x06, 0xFE, 0x03, 0x00, 0x00, 0x01, 0x11, 0x02, 0x21, 0x03, 0x32, 0x05, 0x42, 0x03, 0x32, 0x02, 0x21, 0x01, 0x11, 0x00, 0x00, 0xFB, 0x05, 0xF5, 0x0A, 0xF0, 0x10, 0xEA, 0x15, 0xF0, 0x10, 0xF5, 0x0A, 0xFB, 0x05, 0x00, 0x00, 0x0D, 0xA3, 0x0F, 0x0E, 0x0B, 0x47, 0x00, 0x90, 0x0A, 0xA4, 0x03, 0xD2, 0x00, 0x7B, 0x00, 0xEA, 0x01, 0xC8, 0x02, 0x37, 0x8C, 0x77, 0x00, 0x18, 0x01, 0xCA, 0x01, 0x86,

    4, _NON_AUTOINC, 0xD1, 0x1A,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF9, 0x00, 0xF2, 0x00, 0xEB, 0x00, 0xE4, 0x00, 0xEB, 0x00, 0xF2, 0x00, 0xF9, 0x00, 0x00, 0x00, 0xE6, 0x15, 0xCB, 0x2A, 0xB1, 0x3F, 0x96, 0x54, 0xB1, 0x3F, 0xCB, 0x2A, 0xE6, 0x15, 0x00, 0x00, 0xDB, 0xFA, 0xB5, 0xF5, 0x90, 0xEF, 0x80, 0xEA, 0x90, 0xEF, 0xB5, 0xF5, 0xDB, 0xFA, 0x00, 0x00, 0xF0, 0x10, 0xE0, 0x1F, 0xD0, 0x2F, 0xBF, 0x3F, 0xD0, 0x2F, 0xE0, 0x1F, 0xF0, 0x10, 0x00, 0x00, 0xD9, 0xF4, 0xB3, 0xE8, 0x8C, 0xDC, 0x80, 0xD0, 0x8C, 0xDC, 0xB3, 0xE8, 0xD9, 0xF4, 0x00, 0x00, 0x08, 0x08, 0x0A, 0x4E, 0x08, 0x94, 0x0A, 0xA4, 0x09, 0x1A, 0x06, 0x09, 0x00, 0x40, 0x01, 0xF7, 0x02, 0x56, 0x02, 0xBB, 0x95, 0x65, 0x00, 0xA9, 0x01, 0x64, 0x00, 0x0B,

    4, _NON_AUTOINC, 0xD1, 0x1B,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x12, 0xEE, 0x23, 0xDD, 0x35, 0xCB, 0x47, 0xB9, 0x59, 0xA8, 0x6A, 0x96, 0x7C, 0x84, 0x7F, 0x80, 0x06, 0xF5, 0x0B, 0xE9, 0x11, 0xDE, 0x17, 0xD3, 0x1C, 0xC8, 0x22, 0xBC, 0x27, 0xB1, 0x2D, 0xA6, 0x13, 0xF7, 0x26, 0xEE, 0x3A, 0xE4, 0x4D, 0xDB, 0x60, 0xD2, 0x73, 0xC9, 0x7F, 0xC0, 0x7F, 0xB7, 0x08, 0xEF, 0x11, 0xDF, 0x19, 0xCE, 0x21, 0xBD, 0x2A, 0xAC, 0x32, 0x9C, 0x3B, 0x8B, 0x43, 0x80, 0x19, 0x00, 0x31, 0x00, 0x4A, 0x00, 0x63, 0x00, 0x7B, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x0A, 0xEB, 0x09, 0x86, 0x0B, 0x72, 0x09, 0x1A, 0x0C, 0x05, 0x08, 0xC4, 0x00, 0x55, 0x01, 0x65, 0x01, 0xBC, 0x02, 0x0E, 0x9E, 0x47, 0x01, 0xBE, 0x01, 0xB5, 0x01, 0xE0,

    4, _NON_AUTOINC, 0xD1, 0x1C,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x05, 0x0A, 0x0A, 0x14, 0x0F, 0x1E, 0x14, 0x28, 0x19, 0x32, 0x1E, 0x3C, 0x23, 0x47, 0x28, 0x4F, 0x18, 0x00, 0x30, 0x00, 0x47, 0x00, 0x5F, 0x00, 0x77, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x02, 0x05, 0x05, 0x0A, 0x07, 0x0F, 0x0A, 0x14, 0x0C, 0x19, 0x0F, 0x1E, 0x11, 0x23, 0x14, 0x27, 0x13, 0x00, 0x27, 0x00, 0x3A, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x75, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0xF3, 0x2A, 0xE7, 0x54, 0xDA, 0x7E, 0xCE, 0x7F, 0xC1, 0x7F, 0xB5, 0x7F, 0xA8, 0x7F, 0x9C, 0x7F, 0x03, 0xFB, 0x0F, 0x6D, 0x05, 0x1B, 0x0C, 0x05, 0x07, 0x70, 0x0A, 0xD2, 0x00, 0xFF, 0x02, 0x5C, 0x03, 0x09, 0x04, 0xD2, 0x8E, 0x55, 0x01, 0xD3, 0x00, 0x02, 0x00, 0x06,

    4, _NON_AUTOINC, 0xD1, 0x1D,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF3, 0x19, 0xE7, 0x32, 0xDA, 0x4C, 0xCE, 0x65, 0xC1, 0x7E, 0xB4, 0x7F, 0xA8, 0x7F, 0x9C, 0x7F, 0xFD, 0x10, 0xFA, 0x20, 0xF7, 0x30, 0xF3, 0x41, 0xF0, 0x51, 0xED, 0x61, 0xEA, 0x71, 0xE7, 0x7F, 0xE3, 0x23, 0xC6, 0x47, 0xAA, 0x6A, 0x8D, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0xFF, 0x13, 0xFE, 0x27, 0xFD, 0x3A, 0xFB, 0x4D, 0xFA, 0x61, 0xF9, 0x74, 0xF8, 0x7F, 0xF7, 0x7F, 0xDA, 0x19, 0xB5, 0x33, 0x8F, 0x4C, 0x80, 0x65, 0x80, 0x7E, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x07, 0xF8, 0x07, 0xA9, 0x06, 0x30, 0x07, 0x70, 0x05, 0x8E, 0x0F, 0xA4, 0x00, 0x28, 0x00, 0x5C, 0x01, 0xB0, 0x02, 0x2E, 0x83, 0x44, 0x01, 0xE0, 0x01, 0xF5, 0x01, 0xB5,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD2, 0x00,
    4, _NON_AUTOINC, 0xD4, 0x00,

    _END
};

BYTE code tQC_ICM_SETTING2[] =
{
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xD0, 0x9F,
    4, _NON_AUTOINC, 0xD1, 0x08,
    4, _NON_AUTOINC, 0xD1, 0x08,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x0E, 0xE4, 0x1C, 0xC8, 0x2A, 0xAC, 0x38, 0x90, 0x46, 0x80, 0x54, 0x80, 0x62, 0x80, 0x70, 0x80, 0x07, 0xF2, 0x0E, 0xE4, 0x15, 0xD6, 0x1C, 0xC9, 0x23, 0xBB, 0x2A, 0xAD, 0x31, 0x9F, 0x37, 0x91, 0x0B, 0x00, 0x16, 0x00, 0x21, 0x00, 0x2C, 0x00, 0x38, 0x00, 0x43, 0x00, 0x4E, 0x00, 0x59, 0x00, 0x0E, 0xE3, 0x1D, 0xC6, 0x2B, 0xAA, 0x3A, 0x8D, 0x48, 0x80, 0x56, 0x80, 0x65, 0x80, 0x73, 0x80, 0x1D, 0xFC, 0x3B, 0xF8, 0x58, 0xF5, 0x75, 0xF1, 0x7F, 0xED, 0x7F, 0xE9, 0x7F, 0xE6, 0x7F, 0xE3, 0x03, 0xFB, 0x04, 0xE7, 0x02, 0x4F, 0x05, 0x9B, 0x00, 0x90, 0x01, 0xC8, 0x00, 0x80, 0x01, 0x0A, 0x01, 0x80, 0x02, 0x0A, 0x8E, 0x56, 0x01, 0xD3, 0x01, 0xFA, 0x01, 0xFE,

    4, _NON_AUTOINC, 0xD1, 0x09,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x20, 0x00, 0x41, 0x00, 0x61, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x15, 0x00, 0x2A, 0x00, 0x3F, 0x00, 0x54, 0x00, 0x69, 0x00, 0x7E, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x12, 0x0B, 0x25, 0x16, 0x37, 0x21, 0x49, 0x2B, 0x5C, 0x36, 0x6E, 0x41, 0x7F, 0x4C, 0x7F, 0x56, 0x0C, 0x00, 0x18, 0x00, 0x23, 0x00, 0x2F, 0x00, 0x3B, 0x00, 0x47, 0x00, 0x52, 0x00, 0x5E, 0x00, 0x04, 0x08, 0x08, 0x10, 0x0C, 0x19, 0x10, 0x21, 0x14, 0x29, 0x19, 0x31, 0x1D, 0x39, 0x21, 0x41, 0x0D, 0xA3, 0x0F, 0x2E, 0x0B, 0x57, 0x00, 0xAF, 0x0A, 0xA4, 0x03, 0xC8, 0x00, 0x7B, 0x00, 0xF4, 0x01, 0xC8, 0x02, 0x41, 0x95, 0x45, 0x01, 0xC2, 0x00, 0x4B, 0x00, 0x13,

    4, _NON_AUTOINC, 0xD1, 0x0A,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x0A, 0x14, 0x14, 0x29, 0x1F, 0x3D, 0x29, 0x52, 0x33, 0x66, 0x3D, 0x7B, 0x48, 0x7F, 0x51, 0x7F, 0x12, 0x18, 0x25, 0x30, 0x37, 0x49, 0x4A, 0x61, 0x5C, 0x79, 0x6F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x03, 0x0F, 0x05, 0x1F, 0x08, 0x2E, 0x0A, 0x3E, 0x0D, 0x4D, 0x0F, 0x5D, 0x12, 0x6C, 0x14, 0x7C, 0x1C, 0x13, 0x38, 0x25, 0x54, 0x38, 0x71, 0x4A, 0x7F, 0x5D, 0x7F, 0x6F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFD, 0x06, 0xFA, 0x0C, 0xF7, 0x12, 0xF4, 0x18, 0xF1, 0x1E, 0xEE, 0x24, 0xEB, 0x2A, 0xE8, 0x30, 0x08, 0x08, 0x0A, 0x83, 0x08, 0x5B, 0x0A, 0xDC, 0x09, 0x1A, 0x05, 0xE1, 0x00, 0x40, 0x02, 0x1F, 0x02, 0x56, 0x02, 0xE3, 0x9E, 0x46, 0x01, 0x82, 0x00, 0x24, 0x01, 0xC6,

    4, _NON_AUTOINC, 0xD1, 0x0B,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x25, 0x2A, 0x4B, 0x55, 0x70, 0x7F, 0x7F, 0x7F, 0x70, 0x7F, 0x4B, 0x55, 0x25, 0x2A, 0x00, 0x00, 0x27, 0x0F, 0x4E, 0x1E, 0x75, 0x2D, 0x7F, 0x3C, 0x75, 0x2D, 0x4E, 0x1E, 0x27, 0x0F, 0x00, 0x00, 0x19, 0x21, 0x32, 0x41, 0x4B, 0x62, 0x64, 0x7F, 0x4B, 0x62, 0x32, 0x41, 0x19, 0x21, 0x00, 0x00, 0x1C, 0x07, 0x38, 0x0E, 0x54, 0x15, 0x70, 0x1B, 0x54, 0x15, 0x38, 0x0E, 0x1C, 0x07, 0x00, 0x00, 0x0F, 0x1E, 0x1D, 0x3B, 0x2C, 0x59, 0x3B, 0x76, 0x2C, 0x59, 0x1D, 0x3B, 0x0F, 0x1E, 0x00, 0x00, 0x0A, 0xEB, 0x09, 0x54, 0x0B, 0x31, 0x08, 0xE6, 0x0C, 0x05, 0x08, 0x9C, 0x00, 0x55, 0x01, 0x8D, 0x01, 0xBC, 0x02, 0x36, 0xA7, 0x56, 0x00, 0x42, 0x00, 0x13, 0x00, 0xA1,

    4, _NON_AUTOINC, 0xD1, 0x0C,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xEE, 0x24, 0xDC, 0x48, 0xCA, 0x6C, 0xB8, 0x7F, 0xCA, 0x6C, 0xDC, 0x48, 0xEE, 0x24, 0x00, 0x00, 0x02, 0x19, 0x04, 0x33, 0x05, 0x4C, 0x07, 0x65, 0x05, 0x4C, 0x04, 0x33, 0x02, 0x19, 0x00, 0x00, 0xDF, 0x25, 0xBF, 0x49, 0x9E, 0x6E, 0x80, 0x7F, 0x9E, 0x6E, 0xBF, 0x49, 0xDF, 0x25, 0x00, 0x00, 0x07, 0x0E, 0x0D, 0x1B, 0x14, 0x29, 0x1B, 0x36, 0x14, 0x29, 0x0D, 0x1B, 0x07, 0x0E, 0x00, 0x00, 0xCF, 0x04, 0x9E, 0x08, 0x80, 0x0C, 0x80, 0x10, 0x80, 0x0C, 0x9E, 0x08, 0xCF, 0x04, 0x00, 0x00, 0x03, 0xFB, 0x0F, 0x6D, 0x05, 0x1B, 0x0C, 0x05, 0x07, 0xA9, 0x0A, 0xD2, 0x00, 0xFF, 0x02, 0x5C, 0x03, 0x09, 0x04, 0xFA, 0x95, 0x64, 0x00, 0x1C, 0x01, 0xBE, 0x01, 0xE4,

    4, _NON_AUTOINC, 0xD1, 0x0D,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xED, 0x00, 0xDA, 0x00, 0xC8, 0x00, 0xB5, 0x00, 0xC8, 0x00, 0xDA, 0x00, 0xED, 0x00, 0x00, 0x00, 0xE6, 0x0F, 0xCC, 0x1F, 0xB2, 0x2E, 0x98, 0x3E, 0xB2, 0x2E, 0xCC, 0x1F, 0xE6, 0x0F, 0x00, 0x00, 0xDF, 0xF0, 0xBD, 0xE0, 0x9C, 0xD0, 0x80, 0xC0, 0x9C, 0xD0, 0xBD, 0xE0, 0xDF, 0xF0, 0x00, 0x00, 0xE3, 0x26, 0xC6, 0x4B, 0xA9, 0x71, 0x8C, 0x7F, 0xA9, 0x71, 0xC6, 0x4B, 0xE3, 0x26, 0x00, 0x00, 0xDA, 0xDC, 0xB4, 0xB7, 0x8E, 0x93, 0x80, 0x80, 0x8E, 0x93, 0xB4, 0xB7, 0xDA, 0xDC, 0x00, 0x00, 0x07, 0xF8, 0x06, 0x25, 0x06, 0x6C, 0x04, 0xD5, 0x05, 0x66, 0x0D, 0xAC, 0x00, 0xF7, 0x02, 0x54, 0x03, 0x78, 0x04, 0x44, 0x8A, 0x67, 0x00, 0x0F, 0x00, 0x3E, 0x01, 0xFA,
    4, _NON_AUTOINC, 0xD1, 0x08,
    4, _NON_AUTOINC, 0xD2, 0x00,
    4, _NON_AUTOINC, 0xD4, 0x02,

    _END
};

BYTE code tQC_ICM_SETTING3[] =
{
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xD0, 0xFF,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF2, 0x1C, 0xE4, 0x38, 0xD6, 0x54, 0xC8, 0x70, 0xBA, 0x7F, 0xAC, 0x7F, 0x9E, 0x7F, 0x90, 0x7F, 0xF9, 0x0E, 0xF2, 0x1C, 0xEB, 0x2A, 0xE4, 0x37, 0xDD, 0x45, 0xD6, 0x53, 0xCF, 0x61, 0xC9, 0x6F, 0xF5, 0x00, 0xEA, 0x00, 0xDF, 0x00, 0xD4, 0x00, 0xC8, 0x00, 0xBD, 0x00, 0xB2, 0x00, 0xA7, 0x00, 0xF2, 0x1D, 0xE3, 0x3A, 0xD5, 0x56, 0xC6, 0x73, 0xB8, 0x7F, 0xAA, 0x7F, 0x9B, 0x7F, 0x8D, 0x7F, 0xE3, 0x04, 0xC5, 0x08, 0xA8, 0x0B, 0x8B, 0x0F, 0x80, 0x13, 0x80, 0x17, 0x80, 0x1A, 0x80, 0x1D, 0x0C, 0x05, 0x0B, 0x19, 0x0D, 0xB1, 0x0A, 0x65, 0x0F, 0x70, 0x09, 0xC8, 0x00, 0x80, 0x01, 0x0A, 0x01, 0x80, 0x02, 0x0A, 0x95, 0x64, 0x01, 0x5F, 0x00, 0x69, 0x00, 0x3A,

    4, _NON_AUTOINC, 0xD1, 0x19,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xE0, 0x00, 0xBF, 0x00, 0x9F, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xEB, 0x00, 0xD6, 0x00, 0xC1, 0x00, 0xAC, 0x00, 0x97, 0x00, 0x82, 0x00, 0x80, 0x00, 0x80, 0x00, 0xEE, 0xF5, 0xDB, 0xEA, 0xC9, 0xDF, 0xB7, 0xD5, 0xA4, 0xCA, 0x92, 0xBF, 0x80, 0xB4, 0x80, 0xAA, 0xF4, 0x00, 0xE8, 0x00, 0xDD, 0x00, 0xD1, 0x00, 0xC5, 0x00, 0xB9, 0x00, 0xAE, 0x00, 0xA2, 0x00, 0xFC, 0xF8, 0xF8, 0xF0, 0xF4, 0xE7, 0xF0, 0xDF, 0xEC, 0xD7, 0xE7, 0xCF, 0xE3, 0xC7, 0xDF, 0xBF, 0x02, 0x5D, 0x00, 0xD2, 0x04, 0xA9, 0x0F, 0x51, 0x05, 0x5C, 0x0B, 0xC8, 0x00, 0x7B, 0x00, 0xF4, 0x01, 0xC8, 0x02, 0x41, 0x82, 0x06, 0x00, 0x13, 0x00, 0x18, 0x00, 0x42,

    4, _NON_AUTOINC, 0xD1, 0x1A,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF6, 0xEC, 0xEC, 0xD7, 0xE1, 0xC3, 0xD7, 0xAE, 0xCD, 0x9A, 0xC3, 0x85, 0xB8, 0x80, 0xAF, 0x80, 0xEE, 0xE8, 0xDB, 0xD0, 0xC9, 0xB7, 0xB6, 0x9F, 0xA4, 0x87, 0x91, 0x80, 0x80, 0x80, 0x80, 0x80, 0xFD, 0xF1, 0xFB, 0xE1, 0xF8, 0xD2, 0xF6, 0xC2, 0xF3, 0xB3, 0xF1, 0xA3, 0xEE, 0x94, 0xEC, 0x84, 0xE4, 0xED, 0xC8, 0xDB, 0xAC, 0xC8, 0x8F, 0xB6, 0x80, 0xA3, 0x80, 0x91, 0x80, 0x80, 0x80, 0x80, 0x03, 0xFA, 0x06, 0xF4, 0x09, 0xEE, 0x0C, 0xE8, 0x0F, 0xE2, 0x12, 0xDC, 0x15, 0xD6, 0x18, 0xD0, 0x07, 0xF8, 0x05, 0x7D, 0x07, 0xA5, 0x05, 0x24, 0x06, 0xE6, 0x0D, 0xE1, 0x00, 0x40, 0x02, 0x1F, 0x02, 0x56, 0x02, 0xE3, 0x8C, 0x54, 0x00, 0x1C, 0x01, 0xDC, 0x00, 0x8B,

    4, _NON_AUTOINC, 0xD1, 0x1B,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x25, 0x2A, 0x4B, 0x55, 0x70, 0x7F, 0x7F, 0x7F, 0x70, 0x7F, 0x4B, 0x55, 0x25, 0x2A, 0x00, 0x00, 0x27, 0x0F, 0x4E, 0x1E, 0x75, 0x2D, 0x7F, 0x3C, 0x75, 0x2D, 0x4E, 0x1E, 0x27, 0x0F, 0x00, 0x00, 0x19, 0x21, 0x32, 0x41, 0x4B, 0x62, 0x64, 0x7F, 0x4B, 0x62, 0x32, 0x41, 0x19, 0x21, 0x00, 0x00, 0x1C, 0x07, 0x38, 0x0E, 0x54, 0x15, 0x70, 0x1B, 0x54, 0x15, 0x38, 0x0E, 0x1C, 0x07, 0x00, 0x00, 0x0F, 0x1E, 0x1D, 0x3B, 0x2C, 0x59, 0x3B, 0x76, 0x2C, 0x59, 0x1D, 0x3B, 0x0F, 0x1E, 0x00, 0x00, 0x0A, 0xEB, 0x09, 0x54, 0x0B, 0x31, 0x08, 0xE6, 0x0C, 0x05, 0x08, 0x9C, 0x00, 0x55, 0x01, 0x8D, 0x01, 0xBC, 0x02, 0x36, 0x94, 0x65, 0x01, 0x2C, 0x01, 0x7D, 0x01, 0x79,

    4, _NON_AUTOINC, 0xD1, 0x1C,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x12, 0xDC, 0x24, 0xB8, 0x36, 0x94, 0x48, 0x80, 0x36, 0x94, 0x24, 0xB8, 0x12, 0xDC, 0x00, 0x00, 0xFE, 0xE7, 0xFC, 0xCD, 0xFB, 0xB4, 0xF9, 0x9B, 0xFB, 0xB4, 0xFC, 0xCD, 0xFE, 0xE7, 0x00, 0x00, 0x21, 0xDB, 0x41, 0xB7, 0x62, 0x92, 0x7F, 0x80, 0x62, 0x92, 0x41, 0xB7, 0x21, 0xDB, 0x00, 0x00, 0xF9, 0xF2, 0xF3, 0xE5, 0xEC, 0xD7, 0xE5, 0xCA, 0xEC, 0xD7, 0xF3, 0xE5, 0xF9, 0xF2, 0x00, 0x00, 0x31, 0xFC, 0x62, 0xF8, 0x7F, 0xF4, 0x7F, 0xF0, 0x7F, 0xF4, 0x62, 0xF8, 0x31, 0xFC, 0x00, 0x00, 0x0C, 0x05, 0x00, 0x93, 0x0A, 0xE5, 0x03, 0xFB, 0x08, 0x57, 0x02, 0xD2, 0x00, 0xFF, 0x02, 0x5C, 0x03, 0x09, 0x04, 0xFA, 0x9C, 0x70, 0x00, 0x69, 0x01, 0x68, 0x01, 0x9B,

    4, _NON_AUTOINC, 0xD1, 0x1D,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x13, 0x00, 0x26, 0x00, 0x38, 0x00, 0x4B, 0x00, 0x38, 0x00, 0x26, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1A, 0xF1, 0x34, 0xE1, 0x4E, 0xD2, 0x68, 0xC2, 0x4E, 0xD2, 0x34, 0xE1, 0x1A, 0xF1, 0x00, 0x00, 0x21, 0x10, 0x43, 0x20, 0x64, 0x30, 0x7F, 0x40, 0x64, 0x30, 0x43, 0x20, 0x21, 0x10, 0x00, 0x00, 0x1D, 0xDA, 0x3A, 0xB5, 0x57, 0x8F, 0x74, 0x80, 0x57, 0x8F, 0x3A, 0xB5, 0x1D, 0xDA, 0x00, 0x00, 0x26, 0x24, 0x4C, 0x49, 0x72, 0x6D, 0x7F, 0x7F, 0x72, 0x6D, 0x4C, 0x49, 0x26, 0x24, 0x00, 0x00, 0x08, 0x08, 0x09, 0xDB, 0x09, 0x94, 0x0B, 0x2B, 0x0A, 0x9A, 0x05, 0xAC, 0x00, 0xF7, 0x02, 0x54, 0x03, 0x78, 0x04, 0x44, 0x94, 0x55, 0x00, 0xC7, 0x01, 0xA8, 0x00, 0x7E,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD2, 0x00,
    4, _NON_AUTOINC, 0xD4, 0x00,

    _END
};

BYTE code tQC_ICM_SETTING4[] =
{
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xD0, 0xBF,
    4, _NON_AUTOINC, 0xD1, 0x08,
    4, _NON_AUTOINC, 0xD1, 0x08,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x0E, 0xF7, 0x1C, 0xEE, 0x2B, 0xE5, 0x39, 0xDC, 0x4D, 0xE5, 0x62, 0xEE, 0x76, 0xF7, 0x7F, 0x00, 0xF4, 0xEF, 0xE8, 0xDF, 0xDC, 0xCE, 0xD0, 0xBE, 0xC8, 0xCE, 0xBF, 0xDF, 0xB7, 0xEF, 0xAF, 0x00, 0xFB, 0xF0, 0xF6, 0xE1, 0xF1, 0xD1, 0xEC, 0xC2, 0xDE, 0xD1, 0xD1, 0xE1, 0xC4, 0xF0, 0xB7, 0x00, 0x0E, 0xF3, 0x1D, 0xE7, 0x2B, 0xDA, 0x39, 0xCE, 0x3D, 0xB6, 0x41, 0x9E, 0x45, 0x86, 0x49, 0x80, 0x0E, 0xEB, 0x1D, 0xD6, 0x2B, 0xC1, 0x3A, 0xAC, 0x42, 0xC1, 0x4A, 0xD6, 0x52, 0xEB, 0x5A, 0x00, 0x00, 0x96, 0x02, 0x34, 0x0F, 0x05, 0x03, 0xFD, 0x0D, 0x5F, 0x02, 0xD1, 0x00, 0x7F, 0x00, 0xFF, 0x01, 0x7F, 0x01, 0xFF, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x36, 0x00, 0x1C,

    4, _NON_AUTOINC, 0xD1, 0x09,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x10, 0xE3, 0x20, 0xC6, 0x30, 0xA9, 0x40, 0x8C, 0x21, 0x8B, 0x03, 0x8B, 0xE4, 0x8B, 0xC5, 0x8B, 0x0C, 0xDF, 0x18, 0xBD, 0x23, 0x9C, 0x2F, 0x80, 0x17, 0x82, 0xFE, 0x8A, 0xE6, 0x93, 0xCD, 0x9B, 0x0B, 0xDF, 0x16, 0xBE, 0x21, 0x9E, 0x2B, 0x80, 0x07, 0x80, 0xE2, 0x80, 0xBD, 0x80, 0x98, 0x80, 0x0C, 0xEC, 0x18, 0xD8, 0x24, 0xC5, 0x30, 0xB1, 0x33, 0xC5, 0x37, 0xD8, 0x3A, 0xEC, 0x3E, 0x00, 0x0E, 0xF0, 0x1C, 0xE0, 0x2A, 0xD0, 0x38, 0xC0, 0x1D, 0xB6, 0x02, 0xAC, 0xE7, 0xA1, 0xCC, 0x97, 0x0A, 0xD5, 0x0B, 0xBC, 0x0A, 0xA5, 0x0D, 0x5B, 0x09, 0x5C, 0x04, 0xD1, 0x00, 0x84, 0x01, 0x15, 0x01, 0x37, 0x02, 0x37, 0x00, 0x00, 0x00, 0x18, 0x01, 0xCA, 0x01, 0x86,

    4, _NON_AUTOINC, 0xD1, 0x0A,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x0E, 0x0B, 0x1C, 0x16, 0x2A, 0x22, 0x39, 0x2D, 0x25, 0x2D, 0x11, 0x2E, 0xFD, 0x2E, 0xE9, 0x2E, 0x09, 0xF3, 0x12, 0xE5, 0x1B, 0xD8, 0x25, 0xCB, 0x13, 0xBC, 0x02, 0xAE, 0xF1, 0xA0, 0xE0, 0x91, 0x09, 0x1A, 0x12, 0x33, 0x1C, 0x4D, 0x25, 0x67, 0x07, 0x75, 0xEA, 0x7F, 0xCD, 0x7F, 0xAF, 0x7F, 0x18, 0xF9, 0x30, 0xF3, 0x48, 0xEC, 0x60, 0xE6, 0x4C, 0xF5, 0x39, 0x05, 0x25, 0x14, 0x12, 0x23, 0x10, 0x1B, 0x20, 0x36, 0x30, 0x51, 0x40, 0x6C, 0x1E, 0x75, 0xFC, 0x7F, 0xDA, 0x7F, 0xB8, 0x7F, 0x09, 0x7B, 0x08, 0xB8, 0x0A, 0x46, 0x09, 0x5C, 0x0A, 0x5E, 0x07, 0x08, 0x00, 0x7F, 0x02, 0x08, 0x02, 0xA9, 0x02, 0xBB, 0x00, 0x00, 0x00, 0xA9, 0x01, 0x64, 0x00, 0x0B,

    4, _NON_AUTOINC, 0xD1, 0x0B,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x0D, 0x0E, 0x1A, 0x1B, 0x27, 0x29, 0x33, 0x36, 0x3B, 0x29, 0x43, 0x1B, 0x4B, 0x0E, 0x53, 0x00, 0xF6, 0xFF, 0xED, 0xFE, 0xE3, 0xFC, 0xD9, 0xFB, 0xDD, 0x09, 0xE0, 0x17, 0xE4, 0x24, 0xE7, 0x32, 0xE7, 0xF7, 0xCD, 0xEF, 0xB4, 0xE6, 0x9A, 0xDD, 0x90, 0xF0, 0x87, 0x02, 0x80, 0x14, 0x80, 0x25, 0x0F, 0x07, 0x1E, 0x0E, 0x2E, 0x15, 0x3D, 0x1C, 0x33, 0x0A, 0x29, 0xF8, 0x20, 0xE6, 0x16, 0xD4, 0x0A, 0x13, 0x14, 0x26, 0x1D, 0x38, 0x27, 0x4B, 0x31, 0x38, 0x3B, 0x26, 0x45, 0x13, 0x4E, 0x00, 0x0D, 0x43, 0x0B, 0x53, 0x0D, 0xEA, 0x0A, 0x5E, 0x0E, 0xC5, 0x09, 0xC3, 0x00, 0xAA, 0x01, 0x65, 0x01, 0x96, 0x01, 0xD9, 0x8D, 0x64, 0x01, 0xDC, 0x01, 0xE4, 0x00, 0x36,

    4, _NON_AUTOINC, 0xD1, 0x0C,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xEF, 0x19, 0xDE, 0x32, 0xCD, 0x4B, 0xBC, 0x64, 0xDF, 0x6F, 0x02, 0x7A, 0x25, 0x7F, 0x48, 0x7F, 0x07, 0x0D, 0x0E, 0x19, 0x14, 0x26, 0x1B, 0x32, 0x2D, 0x2B, 0x3E, 0x24, 0x4F, 0x1D, 0x61, 0x15, 0x09, 0x0C, 0x11, 0x17, 0x1A, 0x23, 0x22, 0x2F, 0x19, 0x39, 0x11, 0x43, 0x08, 0x4D, 0xFF, 0x57, 0xF3, 0xEE, 0xE6, 0xDC, 0xDA, 0xCB, 0xCD, 0xB9, 0xC7, 0xCB, 0xC2, 0xDC, 0xBD, 0xEE, 0xB8, 0x00, 0x1A, 0xFE, 0x34, 0xFC, 0x4F, 0xFA, 0x69, 0xF8, 0x54, 0xEF, 0x3F, 0xE6, 0x2B, 0xDD, 0x16, 0xD4, 0x05, 0xE9, 0x02, 0xA5, 0x07, 0xA2, 0x0F, 0x6D, 0x07, 0x11, 0x0B, 0xD1, 0x01, 0x00, 0x02, 0xA3, 0x03, 0xF6, 0x04, 0xD2, 0xA7, 0x06, 0x00, 0x3E, 0x00, 0x3A, 0x00, 0x06,

    4, _NON_AUTOINC, 0xD1, 0x0D,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x23, 0xF6, 0x47, 0xEC, 0x6A, 0xE2, 0x7F, 0xD9, 0x7A, 0xC3, 0x66, 0xAE, 0x52, 0x99, 0x3E, 0x84, 0x15, 0xF8, 0x29, 0xF0, 0x3E, 0xE8, 0x52, 0xDF, 0x48, 0xD4, 0x3D, 0xC8, 0x32, 0xBD, 0x27, 0xB2, 0x07, 0x0F, 0x0E, 0x1F, 0x14, 0x2E, 0x1B, 0x3E, 0x0F, 0x38, 0x04, 0x33, 0xF8, 0x2D, 0xEC, 0x28, 0xEF, 0x05, 0xDE, 0x0A, 0xCD, 0x0F, 0xBC, 0x14, 0xC2, 0x24, 0xC9, 0x34, 0xCF, 0x45, 0xD6, 0x55, 0xE3, 0xF2, 0xC6, 0xE3, 0xA9, 0xD5, 0x8C, 0xC6, 0x80, 0xD5, 0x80, 0xE4, 0x80, 0xF2, 0x80, 0x00, 0x06, 0x42, 0x06, 0xF3, 0x05, 0x63, 0x07, 0x11, 0x03, 0xFD, 0x00, 0xA3, 0x00, 0x17, 0x00, 0xA3, 0x01, 0x4F, 0x02, 0x2E, 0x9D, 0x76, 0x00, 0x02, 0x01, 0xD3, 0x00, 0x2D,
    4, _NON_AUTOINC, 0xD1, 0x08,
    4, _NON_AUTOINC, 0xD2, 0x00,
    4, _NON_AUTOINC, 0xD4, 0x02,

    _END
};

BYTE code tQC_ICM_SETTING5[] =
{
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xD0, 0xDF,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF2, 0x09, 0xE4, 0x12, 0xD5, 0x1B, 0xC7, 0x24, 0xB3, 0x1B, 0x9E, 0x12, 0x8A, 0x09, 0x80, 0x00, 0x0C, 0x11, 0x18, 0x21, 0x24, 0x32, 0x30, 0x42, 0x38, 0x32, 0x41, 0x21, 0x49, 0x11, 0x51, 0x00, 0x05, 0x10, 0x0A, 0x1F, 0x0F, 0x2F, 0x14, 0x3E, 0x22, 0x2F, 0x2F, 0x1F, 0x3C, 0x10, 0x49, 0x00, 0xF2, 0x0D, 0xE3, 0x19, 0xD5, 0x26, 0xC7, 0x32, 0xC3, 0x4A, 0xBF, 0x62, 0xBB, 0x7A, 0xB7, 0x7F, 0xF2, 0x15, 0xE3, 0x2A, 0xD5, 0x3F, 0xC6, 0x54, 0xBE, 0x3F, 0xB6, 0x2A, 0xAE, 0x15, 0xA6, 0x00, 0x0F, 0x6A, 0x0D, 0xCC, 0x00, 0xFB, 0x0C, 0x03, 0x02, 0xA1, 0x0A, 0xD1, 0x00, 0x7F, 0x00, 0xFF, 0x01, 0x7F, 0x01, 0xFF, 0x9C, 0x40, 0x01, 0xFA, 0x01, 0xFE, 0x00, 0x02,

    4, _NON_AUTOINC, 0xD1, 0x19,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF0, 0x1D, 0xE0, 0x3A, 0xD0, 0x57, 0xC0, 0x74, 0xDF, 0x75, 0xFD, 0x75, 0x1C, 0x75, 0x3B, 0x75, 0xF4, 0x21, 0xE8, 0x43, 0xDD, 0x64, 0xD1, 0x7F, 0xE9, 0x7E, 0x02, 0x76, 0x1A, 0x6D, 0x33, 0x65, 0xF5, 0x21, 0xEA, 0x42, 0xDF, 0x62, 0xD5, 0x7F, 0xF9, 0x7F, 0x1E, 0x7F, 0x43, 0x7F, 0x68, 0x7F, 0xF4, 0x14, 0xE8, 0x28, 0xDC, 0x3B, 0xD0, 0x4F, 0xCD, 0x3B, 0xC9, 0x28, 0xC6, 0x14, 0xC2, 0x00, 0xF2, 0x10, 0xE4, 0x20, 0xD6, 0x30, 0xC8, 0x40, 0xE3, 0x4A, 0xFE, 0x54, 0x19, 0x5F, 0x34, 0x69, 0x05, 0x2B, 0x04, 0x44, 0x05, 0x5B, 0x02, 0xA5, 0x06, 0xA4, 0x0C, 0xD1, 0x00, 0x84, 0x01, 0x15, 0x01, 0x37, 0x02, 0x37, 0x9E, 0x54, 0x00, 0x0B, 0x01, 0xFA, 0x01, 0xFA,

    4, _NON_AUTOINC, 0xD1, 0x1A,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF2, 0xF5, 0xE4, 0xEA, 0xD6, 0xDE, 0xC7, 0xD3, 0xDB, 0xD3, 0xEF, 0xD2, 0x03, 0xD2, 0x17, 0xD2, 0xF7, 0x0D, 0xEE, 0x1B, 0xE5, 0x28, 0xDB, 0x35, 0xED, 0x44, 0xFE, 0x52, 0x0F, 0x60, 0x20, 0x6F, 0xF7, 0xE6, 0xEE, 0xCD, 0xE4, 0xB3, 0xDB, 0x99, 0xF9, 0x8B, 0x16, 0x80, 0x33, 0x80, 0x51, 0x80, 0xE8, 0x07, 0xD0, 0x0D, 0xB8, 0x14, 0xA0, 0x1A, 0xB4, 0x0B, 0xC7, 0xFB, 0xDB, 0xEC, 0xEE, 0xDD, 0xF0, 0xE5, 0xE0, 0xCA, 0xD0, 0xAF, 0xC0, 0x94, 0xE2, 0x8B, 0x04, 0x81, 0x26, 0x80, 0x48, 0x80, 0x06, 0x85, 0x07, 0x48, 0x05, 0xBA, 0x06, 0xA4, 0x05, 0xA2, 0x0F, 0x08, 0x00, 0x7F, 0x02, 0x08, 0x02, 0xA9, 0x02, 0xBB, 0x81, 0x77, 0x00, 0x02, 0x01, 0xE4, 0x00, 0x18,

    4, _NON_AUTOINC, 0xD1, 0x1B,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF3, 0xF2, 0xE6, 0xE5, 0xD9, 0xD7, 0xCD, 0xCA, 0xC5, 0xD7, 0xBD, 0xE5, 0xB5, 0xF2, 0xAD, 0x00, 0x0A, 0x01, 0x13, 0x02, 0x1D, 0x04, 0x27, 0x05, 0x23, 0xF7, 0x20, 0xE9, 0x1C, 0xDC, 0x19, 0xCE, 0x19, 0x09, 0x33, 0x11, 0x4C, 0x1A, 0x66, 0x23, 0x70, 0x10, 0x79, 0xFE, 0x7F, 0xEC, 0x7F, 0xDB, 0xF1, 0xF9, 0xE2, 0xF2, 0xD2, 0xEB, 0xC3, 0xE4, 0xCD, 0xF6, 0xD7, 0x08, 0xE0, 0x1A, 0xEA, 0x2C, 0xF6, 0xED, 0xEC, 0xDA, 0xE3, 0xC8, 0xD9, 0xB5, 0xCF, 0xC8, 0xC5, 0xDA, 0xBB, 0xED, 0xB2, 0x00, 0x02, 0xBD, 0x04, 0xAD, 0x02, 0x16, 0x05, 0xA2, 0x01, 0x3B, 0x01, 0xC3, 0x00, 0xAA, 0x01, 0x65, 0x01, 0x96, 0x01, 0xD9, 0x00, 0x47, 0x01, 0xDC, 0x01, 0xE4, 0x00, 0x36,

    4, _NON_AUTOINC, 0xD1, 0x1C,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x11, 0xE7, 0x22, 0xCE, 0x33, 0xB5, 0x44, 0x9C, 0x21, 0x91, 0xFE, 0x86, 0xDB, 0x80, 0xB8, 0x80, 0xF9, 0xF3, 0xF2, 0xE7, 0xEC, 0xDA, 0xE5, 0xCE, 0xD3, 0xD5, 0xC2, 0xDC, 0xB1, 0xE3, 0x9F, 0xEB, 0xF7, 0xF4, 0xEF, 0xE9, 0xE6, 0xDD, 0xDE, 0xD1, 0xE7, 0xC7, 0xEF, 0xBD, 0xF8, 0xB3, 0x01, 0xA9, 0x0D, 0x12, 0x1A, 0x24, 0x26, 0x35, 0x33, 0x47, 0x39, 0x35, 0x3E, 0x24, 0x43, 0x12, 0x48, 0x00, 0xE6, 0x02, 0xCC, 0x04, 0xB1, 0x06, 0x97, 0x08, 0xAC, 0x11, 0xC1, 0x1A, 0xD5, 0x23, 0xEA, 0x2C, 0x0A, 0x17, 0x0D, 0x5B, 0x08, 0x5E, 0x00, 0x93, 0x08, 0xEF, 0x03, 0xD1, 0x01, 0x00, 0x02, 0xA3, 0x03, 0xF6, 0x04, 0xD2, 0x00, 0x55, 0x00, 0x3E, 0x00, 0x3A, 0x00, 0x06,

    4, _NON_AUTOINC, 0xD1, 0x1D,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xDD, 0x0A, 0xB9, 0x14, 0x96, 0x1E, 0x80, 0x27, 0x86, 0x3D, 0x9A, 0x52, 0xAE, 0x67, 0xC2, 0x7C, 0xEB, 0x08, 0xD7, 0x10, 0xC2, 0x18, 0xAE, 0x21, 0xB8, 0x2C, 0xC3, 0x38, 0xCE, 0x43, 0xD9, 0x4E, 0xF9, 0xF1, 0xF2, 0xE1, 0xEC, 0xD2, 0xE5, 0xC2, 0xF1, 0xC8, 0xFC, 0xCD, 0x08, 0xD3, 0x14, 0xD8, 0x11, 0xFB, 0x22, 0xF6, 0x33, 0xF1, 0x44, 0xEC, 0x3E, 0xDC, 0x37, 0xCC, 0x31, 0xBB, 0x2A, 0xAB, 0x1D, 0x0E, 0x3A, 0x1D, 0x57, 0x2B, 0x74, 0x3A, 0x7F, 0x2B, 0x7F, 0x1C, 0x7F, 0x0E, 0x7F, 0x00, 0x09, 0xBE, 0x09, 0x0D, 0x0A, 0x9D, 0x08, 0xEF, 0x0C, 0x03, 0x08, 0xA3, 0x00, 0x17, 0x00, 0xA3, 0x01, 0x4F, 0x02, 0x2E, 0x00, 0x44, 0x00, 0x02, 0x01, 0xD3, 0x00, 0x2D,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD2, 0x00,
    4, _NON_AUTOINC, 0xD4, 0x00,

    _END
};

BYTE code tQC_ICM_SETTING6[] =
{
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xD0, 0xB5,
    4, _NON_AUTOINC, 0xD1, 0x00,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x24, 0x09, 0x48, 0x11, 0x6C, 0x1A, 0x7F, 0x23, 0x77, 0x32, 0x60, 0x41, 0x48, 0x50, 0x30, 0x5F, 0x13, 0x06, 0x25, 0x0C, 0x38, 0x12, 0x4A, 0x19, 0x42, 0x27, 0x3A, 0x36, 0x32, 0x45, 0x2A, 0x54, 0x19, 0x09, 0x31, 0x11, 0x4A, 0x1A, 0x62, 0x22, 0x51, 0x2A, 0x3F, 0x33, 0x2E, 0x3B, 0x1D, 0x43, 0x1C, 0x04, 0x38, 0x08, 0x55, 0x0C, 0x71, 0x10, 0x63, 0x28, 0x55, 0x40, 0x47, 0x59, 0x38, 0x71, 0x1B, 0x12, 0x36, 0x24, 0x51, 0x36, 0x6C, 0x48, 0x47, 0x4A, 0x22, 0x4C, 0xFD, 0x4E, 0xD8, 0x50, 0x06, 0xD1, 0x06, 0x30, 0x07, 0x7B, 0x05, 0x8D, 0x07, 0xB5, 0x0E, 0x2D, 0x00, 0x7F, 0x00, 0xFF, 0x01, 0x7F, 0x01, 0xFF, 0xA5, 0x07, 0x00, 0x0F, 0x00, 0x02, 0x01, 0xF5,

    4, _NON_AUTOINC, 0xD1, 0x01,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF0, 0x35, 0xE1, 0x6A, 0xD1, 0x7F, 0xC1, 0x7F, 0xD1, 0x7F, 0xE1, 0x6A, 0xF0, 0x35, 0x00, 0x00, 0xFD, 0x1A, 0xFA, 0x35, 0xF7, 0x4F, 0xF4, 0x69, 0xF7, 0x4F, 0xFA, 0x35, 0xFD, 0x1A, 0x00, 0x00, 0xFE, 0x03, 0xFC, 0x06, 0xF9, 0x09, 0xF7, 0x0C, 0xF9, 0x09, 0xFC, 0x06, 0xFE, 0x03, 0x00, 0x00, 0x01, 0x11, 0x02, 0x21, 0x03, 0x32, 0x05, 0x42, 0x03, 0x32, 0x02, 0x21, 0x01, 0x11, 0x00, 0x00, 0xFB, 0x05, 0xF5, 0x0A, 0xF0, 0x10, 0xEA, 0x15, 0xF0, 0x10, 0xF5, 0x0A, 0xFB, 0x05, 0x00, 0x00, 0x0D, 0xA3, 0x0F, 0x0E, 0x0B, 0x47, 0x00, 0x90, 0x0A, 0xA4, 0x03, 0xD2, 0x00, 0x7B, 0x00, 0xEA, 0x01, 0xC8, 0x02, 0x37, 0x8C, 0x77, 0x00, 0x18, 0x01, 0xCA, 0x01, 0x86,

    4, _NON_AUTOINC, 0xD1, 0x02,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF1, 0xF9, 0xE3, 0xF2, 0xD4, 0xEB, 0xC5, 0xE4, 0xB9, 0xEB, 0xAE, 0xF2, 0xA2, 0xF9, 0x96, 0x00, 0xE2, 0xF1, 0xC5, 0xE3, 0xA7, 0xD4, 0x89, 0xC5, 0x9A, 0xEE, 0xAB, 0x16, 0xBC, 0x3F, 0xCD, 0x67, 0xFB, 0xD8, 0xF6, 0xAF, 0xF1, 0x87, 0xEC, 0x80, 0xD3, 0x87, 0xBB, 0xAF, 0xA2, 0xD8, 0x8A, 0x00, 0xE9, 0xFE, 0xD2, 0xFB, 0xBC, 0xF9, 0xA5, 0xF6, 0xB2, 0x0C, 0xBF, 0x21, 0xCC, 0x37, 0xDA, 0x4D, 0x0E, 0xD2, 0x1D, 0xA4, 0x2B, 0x80, 0x3A, 0x80, 0x21, 0x80, 0x09, 0x9E, 0xF1, 0xCA, 0xD9, 0xF6, 0x0F, 0xFA, 0x0B, 0xCE, 0x03, 0xC1, 0x0A, 0xA3, 0x04, 0x12, 0x09, 0xF6, 0x00, 0xBF, 0x02, 0x08, 0x03, 0x29, 0x03, 0x44, 0xA7, 0x00, 0x00, 0x0F, 0x01, 0xE4, 0x01, 0xE1,

    4, _NON_AUTOINC, 0xD1, 0x03,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x12, 0xEE, 0x23, 0xDD, 0x35, 0xCB, 0x47, 0xB9, 0x59, 0xA8, 0x6A, 0x96, 0x7C, 0x84, 0x7F, 0x80, 0x06, 0xF5, 0x0B, 0xE9, 0x11, 0xDE, 0x17, 0xD3, 0x1C, 0xC8, 0x22, 0xBC, 0x27, 0xB1, 0x2D, 0xA6, 0x13, 0xF7, 0x26, 0xEE, 0x3A, 0xE4, 0x4D, 0xDB, 0x60, 0xD2, 0x73, 0xC9, 0x7F, 0xC0, 0x7F, 0xB7, 0x08, 0xEF, 0x11, 0xDF, 0x19, 0xCE, 0x21, 0xBD, 0x2A, 0xAC, 0x32, 0x9C, 0x3B, 0x8B, 0x43, 0x80, 0x19, 0x00, 0x31, 0x00, 0x4A, 0x00, 0x63, 0x00, 0x7B, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x0A, 0xEB, 0x09, 0x86, 0x0B, 0x72, 0x09, 0x1A, 0x0C, 0x05, 0x08, 0xC4, 0x00, 0x55, 0x01, 0x65, 0x01, 0xBC, 0x02, 0x0E, 0x9E, 0x47, 0x01, 0xBE, 0x01, 0xB5, 0x01, 0xE0,

    4, _NON_AUTOINC, 0xD1, 0x04,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF4, 0x00, 0xE8, 0x00, 0xDC, 0x01, 0xD0, 0x01, 0xD1, 0xEE, 0xD2, 0xDB, 0xD3, 0xC8, 0xD4, 0xB6, 0xED, 0xF2, 0xDB, 0xE4, 0xC8, 0xD6, 0xB5, 0xC8, 0x9B, 0xC7, 0x80, 0xC5, 0x80, 0xC4, 0x80, 0xC3, 0x04, 0xF8, 0x08, 0xF0, 0x0C, 0xE8, 0x10, 0xE0, 0x08, 0xDF, 0xFF, 0xDE, 0xF7, 0xDD, 0xEE, 0xDD, 0xEE, 0x0A, 0xDB, 0x15, 0xC9, 0x1F, 0xB7, 0x29, 0xA6, 0x1F, 0x96, 0x15, 0x85, 0x0A, 0x80, 0x00, 0xE6, 0xD1, 0xCD, 0xA2, 0xB3, 0x80, 0x9A, 0x80, 0xA6, 0x80, 0xB1, 0x80, 0xBD, 0x80, 0xC9, 0x80, 0x0C, 0x1D, 0x0E, 0x5A, 0x0A, 0x0E, 0x01, 0x85, 0x09, 0xC8, 0x03, 0x85, 0x01, 0x00, 0x01, 0xA3, 0x02, 0xF6, 0x03, 0x2D, 0x81, 0x47, 0x01, 0xE3, 0x00, 0x03, 0x00, 0x19,

    4, _NON_AUTOINC, 0xD1, 0x05,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF3, 0x19, 0xE7, 0x32, 0xDA, 0x4C, 0xCE, 0x65, 0xC1, 0x7E, 0xB4, 0x7F, 0xA8, 0x7F, 0x9C, 0x7F, 0xFD, 0x10, 0xFA, 0x20, 0xF7, 0x30, 0xF3, 0x41, 0xF0, 0x51, 0xED, 0x61, 0xEA, 0x71, 0xE7, 0x7F, 0xE3, 0x23, 0xC6, 0x47, 0xAA, 0x6A, 0x8D, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0xFF, 0x13, 0xFE, 0x27, 0xFD, 0x3A, 0xFB, 0x4D, 0xFA, 0x61, 0xF9, 0x74, 0xF8, 0x7F, 0xF7, 0x7F, 0xDA, 0x19, 0xB5, 0x33, 0x8F, 0x4C, 0x80, 0x65, 0x80, 0x7E, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x07, 0xF8, 0x07, 0xA9, 0x06, 0x30, 0x07, 0x70, 0x05, 0x8E, 0x0F, 0xA4, 0x00, 0x28, 0x00, 0x5C, 0x01, 0xB0, 0x02, 0x2E, 0x83, 0x44, 0x01, 0xE0, 0x01, 0xF5, 0x01, 0xB5,
    4, _NON_AUTOINC, 0xD1, 0x00,
    4, _NON_AUTOINC, 0xD2, 0x00,
    4, _NON_AUTOINC, 0xD4, 0x02,

    _END
};

BYTE code tQC_ICM_SETTING7[] =
{
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xD0, 0x8A,
    4, _NON_AUTOINC, 0xD1, 0x08,
    4, _NON_AUTOINC, 0xD1, 0x08,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x24, 0x09, 0x48, 0x11, 0x6C, 0x1A, 0x7F, 0x23, 0x77, 0x32, 0x60, 0x41, 0x48, 0x50, 0x30, 0x5F, 0x13, 0x06, 0x25, 0x0C, 0x38, 0x12, 0x4A, 0x19, 0x42, 0x27, 0x3A, 0x36, 0x32, 0x45, 0x2A, 0x54, 0x19, 0x09, 0x31, 0x11, 0x4A, 0x1A, 0x62, 0x22, 0x51, 0x2A, 0x3F, 0x33, 0x2E, 0x3B, 0x1D, 0x43, 0x1C, 0x04, 0x38, 0x08, 0x55, 0x0C, 0x71, 0x10, 0x63, 0x28, 0x55, 0x40, 0x47, 0x59, 0x38, 0x71, 0x1B, 0x12, 0x36, 0x24, 0x51, 0x36, 0x6C, 0x48, 0x47, 0x4A, 0x22, 0x4C, 0xFD, 0x4E, 0xD8, 0x50, 0x06, 0xD1, 0x06, 0x30, 0x07, 0x7B, 0x05, 0x8D, 0x07, 0xB5, 0x03, 0x85, 0x01, 0x00, 0x01, 0xA3, 0x02, 0xF6, 0x03, 0x2D, 0x87, 0x75, 0x00, 0x0F, 0x00, 0x02, 0x01, 0xF5,

    4, _NON_AUTOINC, 0xD1, 0x09,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x03, 0xEC, 0x06, 0xD8, 0x09, 0xC3, 0x0C, 0xAF, 0x0F, 0x9B, 0x12, 0x87, 0xFF, 0x80, 0xC8, 0x91, 0x0C, 0x15, 0x18, 0x2A, 0x24, 0x3F, 0x2F, 0x54, 0x3B, 0x69, 0x47, 0x7E, 0x53, 0x7F, 0x56, 0x7F, 0xF9, 0x13, 0xF1, 0x25, 0xEA, 0x38, 0xE2, 0x4A, 0xDB, 0x5D, 0xD4, 0x6F, 0xCC, 0x7F, 0xB9, 0x7F, 0x11, 0xF2, 0x23, 0xE3, 0x34, 0xD5, 0x46, 0xC7, 0x57, 0xB9, 0x69, 0xAA, 0x70, 0xC2, 0x6C, 0x00, 0x08, 0xF8, 0x10, 0xF0, 0x18, 0xE8, 0x20, 0xDF, 0x28, 0xD7, 0x30, 0xCF, 0x38, 0xC7, 0x25, 0xB7, 0x06, 0xED, 0x04, 0xDC, 0x07, 0x65, 0x00, 0x8D, 0x06, 0x57, 0x0C, 0x2D, 0x01, 0x84, 0x03, 0x15, 0x04, 0x37, 0x05, 0x08, 0xA7, 0x00, 0x00, 0x09, 0x01, 0xF7, 0x01, 0xCA,

    4, _NON_AUTOINC, 0xD1, 0x0A,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF1, 0xF9, 0xE3, 0xF2, 0xD4, 0xEB, 0xC5, 0xE4, 0xB9, 0xEB, 0xAE, 0xF2, 0xA2, 0xF9, 0x96, 0x00, 0xE2, 0xF1, 0xC5, 0xE3, 0xA7, 0xD4, 0x89, 0xC5, 0x9A, 0xEE, 0xAB, 0x16, 0xBC, 0x3F, 0xCD, 0x67, 0xFB, 0xD8, 0xF6, 0xAF, 0xF1, 0x87, 0xEC, 0x80, 0xD3, 0x87, 0xBB, 0xAF, 0xA2, 0xD8, 0x8A, 0x00, 0xE9, 0xFE, 0xD2, 0xFB, 0xBC, 0xF9, 0xA5, 0xF6, 0xB2, 0x0C, 0xBF, 0x21, 0xCC, 0x37, 0xDA, 0x4D, 0x0E, 0xD2, 0x1D, 0xA4, 0x2B, 0x80, 0x3A, 0x80, 0x21, 0x80, 0x09, 0x9E, 0xF1, 0xCA, 0xD9, 0xF6, 0x0F, 0xFA, 0x0B, 0xCE, 0x03, 0xC1, 0x0A, 0xA3, 0x04, 0x12, 0x09, 0xF6, 0x00, 0xBF, 0x02, 0x08, 0x03, 0x29, 0x03, 0x44, 0x95, 0x65, 0x00, 0x0F, 0x01, 0xE4, 0x01, 0xE1,

    4, _NON_AUTOINC, 0xD1, 0x0B,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x07, 0xDF, 0x0F, 0xBD, 0x16, 0x9C, 0x1D, 0x80, 0x24, 0x80, 0x2C, 0x80, 0x34, 0x80, 0x60, 0x80, 0x12, 0xF6, 0x25, 0xEB, 0x37, 0xE1, 0x4A, 0xD6, 0x5C, 0xCC, 0x6E, 0xC1, 0x7F, 0xB7, 0x7F, 0xAC, 0x0D, 0xE1, 0x1A, 0xC2, 0x27, 0xA2, 0x34, 0x83, 0x42, 0x80, 0x50, 0x80, 0x74, 0x80, 0x7F, 0xB6, 0xEF, 0xED, 0xDF, 0xDA, 0xCE, 0xC8, 0xBD, 0xB5, 0xAC, 0xA2, 0x9C, 0x8F, 0x8B, 0x80, 0xC1, 0x80, 0x17, 0x0D, 0x2E, 0x19, 0x45, 0x26, 0x5B, 0x33, 0x72, 0x3F, 0x7F, 0x4C, 0x7F, 0x58, 0x7F, 0x63, 0x0A, 0x76, 0x08, 0x32, 0x0B, 0x6E, 0x09, 0x1C, 0x0D, 0x51, 0x07, 0x3B, 0x00, 0xAA, 0x02, 0x9A, 0x03, 0x43, 0x03, 0xF1, 0x81, 0x70, 0x00, 0x01, 0x01, 0xFF, 0x00, 0x02,

    4, _NON_AUTOINC, 0xD1, 0x0C,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF4, 0x00, 0xE8, 0x00, 0xDC, 0x01, 0xD0, 0x01, 0xD1, 0xEE, 0xD2, 0xDB, 0xD3, 0xC8, 0xD4, 0xB6, 0xED, 0xF2, 0xDB, 0xE4, 0xC8, 0xD6, 0xB5, 0xC8, 0x9B, 0xC7, 0x80, 0xC5, 0x80, 0xC4, 0x80, 0xC3, 0x04, 0xF8, 0x08, 0xF0, 0x0C, 0xE8, 0x10, 0xE0, 0x08, 0xDF, 0xFF, 0xDE, 0xF7, 0xDD, 0xEE, 0xDD, 0xEE, 0x0A, 0xDB, 0x15, 0xC9, 0x1F, 0xB7, 0x29, 0xA6, 0x1F, 0x96, 0x15, 0x85, 0x0A, 0x80, 0x00, 0xE6, 0xD1, 0xCD, 0xA2, 0xB3, 0x80, 0x9A, 0x80, 0xA6, 0x80, 0xB1, 0x80, 0xBD, 0x80, 0xC9, 0x80, 0x0C, 0x1D, 0x0E, 0x5A, 0x0A, 0x0E, 0x01, 0x85, 0x09, 0xC8, 0x03, 0x85, 0x01, 0x00, 0x01, 0xA3, 0x02, 0xF6, 0x03, 0x2D, 0x8E, 0x55, 0x01, 0xE3, 0x00, 0x03, 0x00, 0x19,

    4, _NON_AUTOINC, 0xD1, 0x0D,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xE1, 0x0E, 0xC1, 0x1D, 0xA2, 0x2B, 0x82, 0x39, 0x80, 0x47, 0x80, 0x56, 0x80, 0x3E, 0x80, 0x00, 0xFE, 0x23, 0xFC, 0x46, 0xFA, 0x69, 0xF8, 0x7F, 0xF6, 0x7F, 0xF4, 0x7F, 0xD5, 0x7F, 0xAD, 0x7F, 0xDD, 0xE7, 0xB9, 0xCF, 0x96, 0xB6, 0x80, 0x9D, 0x80, 0x85, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x02, 0x1E, 0x04, 0x3D, 0x07, 0x5B, 0x09, 0x79, 0x0B, 0x7F, 0x0D, 0x7F, 0xEA, 0x7F, 0xB9, 0x7F, 0x11, 0xDD, 0x21, 0xB9, 0x32, 0x96, 0x43, 0x80, 0x53, 0x80, 0x64, 0x80, 0x75, 0x80, 0x7F, 0x80, 0x03, 0x54, 0x05, 0x08, 0x01, 0x0E, 0x06, 0x27, 0x09, 0x2F, 0x01, 0x5B, 0x00, 0xD7, 0x01, 0xA3, 0x02, 0x4F, 0x05, 0xD1, 0xA6, 0x00, 0x00, 0x0F, 0x01, 0xF1, 0x01, 0x2C,
    4, _NON_AUTOINC, 0xD1, 0x08,
    4, _NON_AUTOINC, 0xD2, 0x00,
    4, _NON_AUTOINC, 0xD4, 0x00,

    _END
};

BYTE code tQC_ICM_SETTING8[] =
{
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xD0, 0xBF,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xE0, 0x20, 0xBF, 0x3F, 0x9F, 0x5F, 0x80, 0x7E, 0x80, 0x5F, 0x80, 0x3F, 0x80, 0x20, 0x80, 0x00, 0xFE, 0x1A, 0xFB, 0x33, 0xF9, 0x4D, 0xF6, 0x67, 0xE6, 0x61, 0xD6, 0x5C, 0xC7, 0x57, 0xB7, 0x50, 0xF0, 0xFB, 0xE1, 0xF6, 0xD1, 0xF2, 0xC2, 0xED, 0xB2, 0xF2, 0xA2, 0xF6, 0x92, 0xFB, 0x82, 0x00, 0xF4, 0xF2, 0xE9, 0xE3, 0xDD, 0xD5, 0xD2, 0xC7, 0xE0, 0xD0, 0xEE, 0xD9, 0xFC, 0xE2, 0x0A, 0xEB, 0x06, 0xE9, 0x0B, 0xD2, 0x11, 0xBB, 0x17, 0xA4, 0x23, 0xBB, 0x2F, 0xD2, 0x3B, 0xE9, 0x47, 0x00, 0x03, 0x5B, 0x04, 0x9D, 0x01, 0xA2, 0x05, 0x51, 0x00, 0x03, 0x01, 0xFF, 0x00, 0x78, 0x00, 0xFD, 0x01, 0x7D, 0x02, 0x00, 0x83, 0x77, 0x01, 0xAC, 0x01, 0xAC, 0x01, 0xC6,

    4, _NON_AUTOINC, 0xD1, 0x19,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xFC, 0x0D, 0xF8, 0x19, 0xF4, 0x26, 0xF0, 0x32, 0xF9, 0x30, 0x02, 0x2D, 0x0B, 0x2B, 0x14, 0x28, 0x0C, 0xF6, 0x18, 0xEB, 0x24, 0xE1, 0x2F, 0xD7, 0x36, 0xE1, 0x3C, 0xEB, 0x42, 0xF6, 0x48, 0x00, 0x0E, 0x0A, 0x1C, 0x14, 0x2A, 0x1F, 0x38, 0x29, 0x3A, 0x3D, 0x3B, 0x52, 0x3C, 0x67, 0x3E, 0x7B, 0x0C, 0xEF, 0x19, 0xDF, 0x25, 0xCE, 0x32, 0xBE, 0x47, 0xCE, 0x5C, 0xDF, 0x72, 0xEF, 0x7F, 0x00, 0xF5, 0xF7, 0xEA, 0xED, 0xDF, 0xE4, 0xD4, 0xDA, 0xE7, 0xD4, 0xF9, 0xCF, 0x0B, 0xC9, 0x1D, 0xC3, 0x0A, 0xAB, 0x0C, 0xAC, 0x09, 0x69, 0x00, 0x03, 0x08, 0x0A, 0x03, 0xFF, 0x01, 0x03, 0x02, 0x05, 0x02, 0xFF, 0x04, 0x00, 0xAE, 0x66, 0x00, 0x18, 0x01, 0xCA, 0x01, 0x86,

    4, _NON_AUTOINC, 0xD1, 0x1A,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xFC, 0xCF, 0xF8, 0x9E, 0xF4, 0x80, 0xF0, 0x80, 0x09, 0x80, 0x22, 0x80, 0x3B, 0x80, 0x54, 0x80, 0xF4, 0xE2, 0xE8, 0xC3, 0xDC, 0xA5, 0xD0, 0x86, 0xED, 0x82, 0x0B, 0x80, 0x28, 0x80, 0x46, 0x80, 0xFD, 0x16, 0xFA, 0x2C, 0xF7, 0x42, 0xF4, 0x58, 0xE6, 0x63, 0xD9, 0x6E, 0xCB, 0x7A, 0xBE, 0x7F, 0xF2, 0xE0, 0xE5, 0xC0, 0xD7, 0xA0, 0xC9, 0x81, 0xED, 0x80, 0x10, 0x80, 0x33, 0x80, 0x56, 0x80, 0xF9, 0x15, 0xF2, 0x2A, 0xEB, 0x3F, 0xE4, 0x55, 0xD2, 0x5C, 0xC0, 0x63, 0xAE, 0x6A, 0x9D, 0x70, 0x0A, 0x9D, 0x08, 0xD9, 0x0B, 0xC1, 0x08, 0x0A, 0x0C, 0xB0, 0x07, 0xFF, 0x00, 0x93, 0x01, 0xF3, 0x02, 0xAF, 0x03, 0x00, 0xAE, 0x77, 0x00, 0x3A, 0x01, 0xD3, 0x00, 0x3E,

    4, _NON_AUTOINC, 0xD1, 0x1B,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xFA, 0x15, 0xF4, 0x2A, 0xEE, 0x3F, 0xE7, 0x54, 0xCF, 0x3F, 0xB6, 0x2A, 0x9D, 0x15, 0x85, 0x00, 0x02, 0x16, 0x04, 0x2D, 0x05, 0x43, 0x07, 0x5A, 0xF3, 0x44, 0xDF, 0x2F, 0xCA, 0x1A, 0xB6, 0x04, 0x05, 0xF5, 0x0B, 0xE9, 0x10, 0xDE, 0x16, 0xD3, 0x19, 0xDE, 0x1D, 0xE9, 0x21, 0xF5, 0x25, 0x00, 0x05, 0x16, 0x09, 0x2C, 0x0E, 0x42, 0x13, 0x58, 0x02, 0x44, 0xF1, 0x31, 0xE1, 0x1E, 0xD0, 0x09, 0x08, 0xF6, 0x11, 0xEB, 0x19, 0xE1, 0x21, 0xD7, 0x20, 0xE1, 0x1F, 0xEB, 0x1D, 0xF6, 0x1C, 0x00, 0x0E, 0x64, 0x0D, 0x23, 0x0F, 0xFA, 0x0C, 0xB0, 0x03, 0x49, 0x0A, 0xFF, 0x00, 0x20, 0x00, 0x7F, 0x00, 0xFF, 0x02, 0x00, 0xB7, 0x07, 0x01, 0xA4, 0x00, 0x58, 0x00, 0x58,

    4, _NON_AUTOINC, 0xD1, 0x1C,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xF2, 0x18, 0xE3, 0x30, 0xD5, 0x48, 0xC7, 0x5F, 0xD7, 0x4C, 0xE8, 0x39, 0xF8, 0x25, 0x09, 0x12, 0xEF, 0x15, 0xDD, 0x2A, 0xCC, 0x3F, 0xBA, 0x54, 0xBA, 0x3B, 0xBB, 0x22, 0xBB, 0x09, 0xBB, 0xF1, 0x15, 0x04, 0x29, 0x07, 0x3E, 0x0B, 0x52, 0x0E, 0x4A, 0x24, 0x42, 0x39, 0x3A, 0x4E, 0x32, 0x63, 0x0C, 0xFC, 0x19, 0xF7, 0x25, 0xF3, 0x32, 0xEF, 0x35, 0xFB, 0x38, 0x08, 0x3A, 0x14, 0x3D, 0x20, 0x17, 0xFA, 0x2F, 0xF5, 0x46, 0xEF, 0x5E, 0xE9, 0x49, 0xF4, 0x34, 0xFE, 0x1F, 0x09, 0x09, 0x13, 0x04, 0x8D, 0x04, 0x1C, 0x05, 0x4E, 0x03, 0x49, 0x06, 0x98, 0x0C, 0xFF, 0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0xAF, 0x07, 0x01, 0xE8, 0x01, 0xA0, 0x00, 0x3A,

    4, _NON_AUTOINC, 0xD1, 0x1D,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x14, 0x0A, 0x29, 0x15, 0x3D, 0x1F, 0x52, 0x2A, 0x37, 0x2F, 0x1C, 0x34, 0x00, 0x38, 0xE5, 0x3D, 0xF8, 0xF6, 0xF0, 0xEC, 0xE9, 0xE2, 0xE1, 0xD8, 0xDD, 0xCB, 0xDA, 0xBF, 0xD7, 0xB3, 0xD3, 0xA6, 0xF4, 0xF3, 0xE8, 0xE6, 0xDC, 0xD9, 0xD0, 0xCC, 0xE5, 0xBD, 0xF9, 0xAF, 0x0E, 0xA0, 0x22, 0x92, 0x13, 0xFE, 0x26, 0xFC, 0x38, 0xFA, 0x4B, 0xF8, 0x3C, 0x02, 0x2D, 0x0B, 0x1E, 0x14, 0x0F, 0x1E, 0xFB, 0x2B, 0xF6, 0x57, 0xF0, 0x7F, 0xEB, 0x7F, 0xD3, 0x7F, 0xBA, 0x7F, 0xA2, 0x7F, 0x8A, 0x7F, 0x07, 0xF0, 0x06, 0xE8, 0x07, 0x46, 0x06, 0x98, 0x05, 0x51, 0x0E, 0xFF, 0x00, 0x3F, 0x00, 0xFC, 0x01, 0x7C, 0x03, 0x00, 0xB7, 0x06, 0x00, 0x47, 0x00, 0x1C, 0x00, 0x7E,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD2, 0x00,
    4, _NON_AUTOINC, 0xD4, 0x02,

    _END
};

BYTE code tQC_ICM_SETTING9[] =
{
    4, _NON_AUTOINC, 0x9F, 0x07,
    4, _NON_AUTOINC, 0xD0, 0xDF,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xFC, 0xF2, 0xF8, 0xE5, 0xF4, 0xD7, 0xEF, 0xCA, 0xF7, 0xD7, 0xFE, 0xE5, 0x05, 0xF2, 0x0C, 0x00, 0xF7, 0xE5, 0xEF, 0xCA, 0xE6, 0xAF, 0xDE, 0x94, 0xF2, 0x97, 0x07, 0x9A, 0x1B, 0x9D, 0x30, 0xA0, 0xFB, 0x02, 0xF7, 0x03, 0xF2, 0x05, 0xEE, 0x06, 0xE9, 0x05, 0xE4, 0x03, 0xDF, 0x02, 0xDA, 0x00, 0xF9, 0x25, 0xF2, 0x4A, 0xEB, 0x6F, 0xE4, 0x7F, 0xCF, 0x7F, 0xBA, 0x7F, 0xA5, 0x7F, 0x91, 0x7F, 0xE2, 0x16, 0xC4, 0x2C, 0xA6, 0x42, 0x88, 0x58, 0x80, 0x42, 0x80, 0x2C, 0x80, 0x16, 0x80, 0x00, 0x03, 0x21, 0x04, 0x83, 0x01, 0x8F, 0x05, 0x50, 0x00, 0x03, 0x02, 0x00, 0x00, 0x87, 0x01, 0x0C, 0x01, 0x82, 0x01, 0xFF, 0xAE, 0x77, 0x01, 0x30, 0x01, 0x34, 0x00, 0xD4,

    4, _NON_AUTOINC, 0xD1, 0x19,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x15, 0xEB, 0x2A, 0xD7, 0x3F, 0xC2, 0x55, 0xAD, 0x41, 0xC4, 0x2D, 0xDB, 0x19, 0xF2, 0x05, 0x09, 0x05, 0xE3, 0x0A, 0xC7, 0x0F, 0xAA, 0x14, 0x8D, 0xFD, 0x9F, 0xE7, 0xB0, 0xD0, 0xC1, 0xBA, 0xD4, 0xF5, 0xF2, 0xEA, 0xE4, 0xE0, 0xD6, 0xD5, 0xC8, 0xD1, 0xB9, 0xCD, 0xAA, 0xCA, 0x9B, 0xC6, 0x8C, 0xE6, 0x02, 0xCC, 0x03, 0xB2, 0x05, 0x99, 0x06, 0x80, 0x05, 0x80, 0x03, 0x80, 0x02, 0x80, 0x00, 0x04, 0xF1, 0x07, 0xE2, 0x0B, 0xD3, 0x0F, 0xC4, 0x19, 0xB7, 0x23, 0xA9, 0x2E, 0x9C, 0x37, 0x8F, 0x0A, 0xB9, 0x0C, 0xC2, 0x09, 0x67, 0x00, 0x00, 0x08, 0x0A, 0x04, 0x00, 0x00, 0xFC, 0x01, 0xFA, 0x03, 0x00, 0x03, 0xFF, 0xAF, 0x07, 0x01, 0x41, 0x00, 0x9C, 0x00, 0xA5,

    4, _NON_AUTOINC, 0xD1, 0x1A,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x0A, 0x1C, 0x14, 0x38, 0x1E, 0x54, 0x28, 0x70, 0x0B, 0x79, 0xEF, 0x7F, 0xD2, 0x7F, 0xB6, 0x7F, 0x16, 0x10, 0x2C, 0x20, 0x42, 0x2F, 0x58, 0x3F, 0x42, 0x56, 0x2B, 0x6D, 0x15, 0x7F, 0xFE, 0x7F, 0xF9, 0xE3, 0xF3, 0xC6, 0xEC, 0xA9, 0xE6, 0x8D, 0xF6, 0x97, 0x06, 0xA1, 0x16, 0xAB, 0x25, 0xB5, 0x18, 0x0C, 0x2F, 0x18, 0x47, 0x23, 0x5F, 0x2F, 0x57, 0x44, 0x50, 0x59, 0x49, 0x6E, 0x40, 0x7F, 0x07, 0xEC, 0x0E, 0xD8, 0x15, 0xC5, 0x1D, 0xB1, 0x2D, 0xC5, 0x3D, 0xD8, 0x4E, 0xEC, 0x5E, 0x00, 0x0A, 0xC1, 0x08, 0xA6, 0x0B, 0x27, 0x08, 0x08, 0x0C, 0xB0, 0x08, 0x00, 0x00, 0x6C, 0x02, 0x0C, 0x02, 0x51, 0x02, 0xFF, 0x9E, 0x77, 0x01, 0x70, 0x00, 0x5C, 0x00, 0xD0,

    4, _NON_AUTOINC, 0xD1, 0x1B,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x1E, 0xE9, 0x3C, 0xD2, 0x59, 0xBB, 0x77, 0xA4, 0x7F, 0xBB, 0x7F, 0xD2, 0x7F, 0xE9, 0x7F, 0x00, 0x1B, 0xEA, 0x36, 0xD4, 0x51, 0xBE, 0x6B, 0xA8, 0x7F, 0xBE, 0x7F, 0xD4, 0x7F, 0xEA, 0x7F, 0x00, 0xF5, 0x13, 0xE9, 0x26, 0xDE, 0x38, 0xD3, 0x4B, 0xBE, 0x38, 0xAA, 0x26, 0x95, 0x13, 0x81, 0x00, 0x1A, 0xEC, 0x35, 0xD8, 0x4F, 0xC5, 0x69, 0xB1, 0x7F, 0xC5, 0x7F, 0xD8, 0x7F, 0xEC, 0x7F, 0x00, 0xEE, 0x12, 0xDD, 0x24, 0xCB, 0x35, 0xB9, 0x47, 0xAF, 0x35, 0xA4, 0x24, 0x99, 0x12, 0x8E, 0x00, 0x0E, 0x6B, 0x0D, 0x23, 0x00, 0x00, 0x0C, 0xB4, 0x03, 0x49, 0x0B, 0x00, 0x00, 0x1F, 0x00, 0x80, 0x01, 0x00, 0x01, 0xFF, 0x8D, 0x77, 0x00, 0x4B, 0x01, 0xAC, 0x01, 0xCF,

    4, _NON_AUTOINC, 0xD1, 0x1C,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0x03, 0xFA, 0x06, 0xF5, 0x0A, 0xEF, 0x0D, 0xEA, 0x09, 0xEE, 0x06, 0xF3, 0x02, 0xF8, 0xFE, 0xFD, 0x1D, 0x0A, 0x3A, 0x15, 0x58, 0x1F, 0x75, 0x2A, 0x70, 0x50, 0x6B, 0x77, 0x67, 0x7F, 0x62, 0x7F, 0xEF, 0xFC, 0xDD, 0xF9, 0xCC, 0xF5, 0xBB, 0xF2, 0xBA, 0xD0, 0xB9, 0xAF, 0xB7, 0x8E, 0xB7, 0x80, 0x08, 0x21, 0x10, 0x41, 0x19, 0x62, 0x21, 0x7F, 0x3C, 0x7F, 0x57, 0x7F, 0x71, 0x7F, 0x7F, 0x7F, 0xFE, 0xF2, 0xFC, 0xE5, 0xFA, 0xD7, 0xF8, 0xC9, 0xEF, 0xC1, 0xE5, 0xB8, 0xDC, 0xAF, 0xD3, 0xA6, 0x04, 0x8D, 0x04, 0x1C, 0x05, 0x4E, 0x03, 0x4C, 0x06, 0x98, 0x0D, 0x00, 0x00, 0x3F, 0x00, 0x7F, 0x00, 0xFF, 0x01, 0xFF, 0x86, 0x77, 0x00, 0x1C, 0x00, 0x60, 0x01, 0xBE,

    4, _NON_AUTOINC, 0xD1, 0x1D,
    4, _NON_AUTOINC, 0xD2, 0x03,
    111, _NON_AUTOINC, 0xD3, 0xEC, 0xF7, 0xD8, 0xEE, 0xC5, 0xE4, 0xB1, 0xDB, 0xB9, 0xCC, 0xC1, 0xBD, 0xCA, 0xAF, 0xD2, 0xA0, 0x1A, 0x18, 0x34, 0x2F, 0x4E, 0x47, 0x68, 0x5E, 0x5A, 0x72, 0x4C, 0x7F, 0x3E, 0x7F, 0x2F, 0x7F, 0x09, 0x1B, 0x11, 0x36, 0x1A, 0x50, 0x22, 0x6B, 0x09, 0x72, 0xEF, 0x79, 0xD6, 0x7F, 0xBD, 0x7F, 0xE5, 0x12, 0xCA, 0x24, 0xAF, 0x36, 0x94, 0x48, 0xBC, 0x50, 0xE4, 0x58, 0x0C, 0x60, 0x34, 0x68, 0xF9, 0xF6, 0xF1, 0xED, 0xEA, 0xE3, 0xE2, 0xD9, 0xEC, 0xDF, 0xF5, 0xE5, 0xFE, 0xEB, 0x08, 0xF1, 0x07, 0xF3, 0x06, 0xEB, 0x07, 0x3B, 0x06, 0x99, 0x05, 0x51, 0x0F, 0x00, 0x00, 0x40, 0x01, 0x03, 0x01, 0x83, 0x02, 0xFF, 0x8E, 0x77, 0x01, 0xAC, 0x01, 0x82, 0x01, 0xE8,
    4, _NON_AUTOINC, 0xD1, 0x18,
    4, _NON_AUTOINC, 0xD2, 0x00,
    4, _NON_AUTOINC, 0xD4, 0x00,

    _END
};

//--------------------------------------------------
// Code Tables of Contrast & Brightness
//--------------------------------------------------
BYTE code tQC_CON_BRI_SETTING_0[] =
{
    0x8F, 0x06, 0x4F, 0x12, 0x45, 0x78, 0xC6, 0x00, 0x48, 0xAB, 0xDE, 0x01,
};

BYTE code tQC_CON_BRI_SETTING_1[] =
{
    0x48, 0xC8, 0x09, 0x21, 0x43, 0x23, 0x5A, 0x55, 0x8D, 0xCE, 0x3E, 0xFA,
};

BYTE code tQC_CON_BRI_SETTING_2[] =
{
    0xC8, 0x08, 0x19, 0x23, 0x95, 0x74, 0x4D, 0x8C, 0xDD, 0xAB, 0xFE, 0xC3,
};

BYTE code tQC_CON_BRI_SETTING_3[] =
{
    0x00, 0x08, 0x19, 0x00, 0x95, 0xAC, 0x4D, 0x48, 0xDD, 0xAB, 0xEF, 0xC3,
};

BYTE code tQC_CON_BRI_SETTING_4[] =
{
    0x01, 0x08, 0x19, 0x01, 0x95, 0xAF, 0x4D, 0x48, 0xDD, 0xAB, 0xEB, 0x34,
};

//--------------------------------------------------
// Description  : CtsBri Result
//--------------------------------------------------
BYTE code tQC_CON_BRI_DCRC_TABLE_0[] =
{
    0x0C, 0x2E, 0x07, 0xE7, 0x98, 0x64,
};

BYTE code tQC_CON_BRI_DCRC_TABLE_1[] =
{
    0x88, 0x3F, 0x62, 0x8E, 0x6A, 0x00,
};

BYTE code tQC_CON_BRI_DCRC_TABLE_2[] =
{
    0x52, 0xD7, 0x5A, 0xBE, 0xAB, 0x93,
};

BYTE code tQC_CON_BRI_DCRC_TABLE_3[] =
{
    0x90, 0xE2, 0xE0, 0x9E, 0xB9, 0xEC,
};

BYTE code tQC_CON_BRI_DCRC_TABLE_4[] =
{
    0xC2, 0x7E, 0xC2, 0xFA, 0xDE, 0x31,
};


// YCC to RGB Table
BYTE code tQC_CONV_YUV2RGB_TABLE0[] =
{
    4, _NON_AUTOINC, 0x9F, 0x14,
    4, _NON_AUTOINC, 0xA1, 0x07,
    4, _NON_AUTOINC, 0xA2, 0x04,
    4, _NON_AUTOINC, 0xA3, 0xA8,
    4, _NON_AUTOINC, 0xA4, 0x07,
    4, _NON_AUTOINC, 0xA5, 0x2C,
    4, _NON_AUTOINC, 0xA6, 0x00,
    4, _NON_AUTOINC, 0xA7, 0xDA,
    4, _NON_AUTOINC, 0xA8, 0x02,
    4, _NON_AUTOINC, 0xA9, 0x22,
    4, _NON_AUTOINC, 0xAA, 0x08,
    4, _NON_AUTOINC, 0xAB, 0x73,
    4, _NON_AUTOINC, 0xAC, 0x00,
    4, _NON_AUTOINC, 0xAD, 0x00,
    4, _NON_AUTOINC, 0xAE, 0x00,
    4, _NON_AUTOINC, 0xAF, 0x00,
    4, _NON_AUTOINC, 0xB0, 0x00,
    4, _NON_AUTOINC, 0xB1, 0x00,
    4, _NON_AUTOINC, 0xB2, 0x02,
    4, _NON_AUTOINC, 0xB3, 0x00,
    4, _NON_AUTOINC, 0xB4, 0x02,
    4, _NON_AUTOINC, 0xB5, 0x00,
    4, _NON_AUTOINC, 0xB6, 0x02,
    4, _NON_AUTOINC, 0xB7, 0x00,

    _END
};

BYTE code tQC_CONV_YUV2RGB_TABLE1[] =
{
    4, _NON_AUTOINC, 0x9F, 0x14,
    4, _NON_AUTOINC, 0xA1, 0x11,
    4, _NON_AUTOINC, 0xA2, 0x00,
    4, _NON_AUTOINC, 0xA3, 0x00,
    4, _NON_AUTOINC, 0xA4, 0x02,
    4, _NON_AUTOINC, 0xA5, 0x00,
    4, _NON_AUTOINC, 0xA6, 0x00,
    4, _NON_AUTOINC, 0xA7, 0x00,
    4, _NON_AUTOINC, 0xA8, 0x00,
    4, _NON_AUTOINC, 0xA9, 0x00,
    4, _NON_AUTOINC, 0xAA, 0x02,
    4, _NON_AUTOINC, 0xAB, 0x00,
    4, _NON_AUTOINC, 0xAC, 0x3C,
    4, _NON_AUTOINC, 0xAD, 0x00,
    4, _NON_AUTOINC, 0xAE, 0x3C,
    4, _NON_AUTOINC, 0xAF, 0x00,
    4, _NON_AUTOINC, 0xB0, 0x3C,
    4, _NON_AUTOINC, 0xB1, 0x00,
    4, _NON_AUTOINC, 0xB2, 0x02,
    4, _NON_AUTOINC, 0xB3, 0x54,
    4, _NON_AUTOINC, 0xB4, 0x02,
    4, _NON_AUTOINC, 0xB5, 0x54,
    4, _NON_AUTOINC, 0xB6, 0x02,
    4, _NON_AUTOINC, 0xB7, 0x54,

    _END
};

BYTE code tQC_CONV_YUV2RGB_TABLE2[] =
{
    4, _NON_AUTOINC, 0x9F, 0x14,
    4, _NON_AUTOINC, 0xA1, 0x03,
    4, _NON_AUTOINC, 0xA2, 0x00,
    4, _NON_AUTOINC, 0xA3, 0x00,
    4, _NON_AUTOINC, 0xA4, 0x00,
    4, _NON_AUTOINC, 0xA5, 0x00,
    4, _NON_AUTOINC, 0xA6, 0x00,
    4, _NON_AUTOINC, 0xA7, 0x00,
    4, _NON_AUTOINC, 0xA8, 0x00,
    4, _NON_AUTOINC, 0xA9, 0x00,
    4, _NON_AUTOINC, 0xAA, 0x00,
    4, _NON_AUTOINC, 0xAB, 0x00,
    4, _NON_AUTOINC, 0xAC, 0x33,
    4, _NON_AUTOINC, 0xAD, 0x33,
    4, _NON_AUTOINC, 0xAE, 0x00,
    4, _NON_AUTOINC, 0xAF, 0x00,
    4, _NON_AUTOINC, 0xB0, 0x0C,
    4, _NON_AUTOINC, 0xB1, 0xCC,
    4, _NON_AUTOINC, 0xB2, 0x03,
    4, _NON_AUTOINC, 0xB3, 0xFF,
    4, _NON_AUTOINC, 0xB4, 0x02,
    4, _NON_AUTOINC, 0xB5, 0x00,
    4, _NON_AUTOINC, 0xB6, 0x01,
    4, _NON_AUTOINC, 0xB7, 0x11,

    _END
};

BYTE code tQC_CONV_YUV2RGB_TABLE3[] =
{
    4, _NON_AUTOINC, 0x9F, 0x14,
    4, _NON_AUTOINC, 0xA1, 0x05,
    4, _NON_AUTOINC, 0xA2, 0x06,
    4, _NON_AUTOINC, 0xA3, 0x66,
    4, _NON_AUTOINC, 0xA4, 0x04,
    4, _NON_AUTOINC, 0xA5, 0x21,
    4, _NON_AUTOINC, 0xA6, 0x01,
    4, _NON_AUTOINC, 0xA7, 0xA5,
    4, _NON_AUTOINC, 0xA8, 0x03,
    4, _NON_AUTOINC, 0xA9, 0xCD,
    4, _NON_AUTOINC, 0xAA, 0x00,
    4, _NON_AUTOINC, 0xAB, 0x30,
    4, _NON_AUTOINC, 0xAC, 0x12,
    4, _NON_AUTOINC, 0xAD, 0x34,
    4, _NON_AUTOINC, 0xAE, 0x16,
    4, _NON_AUTOINC, 0xAF, 0x78,
    4, _NON_AUTOINC, 0xB0, 0x3F,
    4, _NON_AUTOINC, 0xB1, 0xFF,
    4, _NON_AUTOINC, 0xB2, 0x01,
    4, _NON_AUTOINC, 0xB3, 0x55,
    4, _NON_AUTOINC, 0xB4, 0x00,
    4, _NON_AUTOINC, 0xB5, 0x00,
    4, _NON_AUTOINC, 0xB6, 0x00,
    4, _NON_AUTOINC, 0xB7, 0x80,

    _END
};

BYTE code tQC_CONV_YUV2RGB_TABLE4[] =
{
    4, _NON_AUTOINC, 0x9F, 0x14,
    4, _NON_AUTOINC, 0xA1, 0x01,
    4, _NON_AUTOINC, 0xA2, 0x0F,
    4, _NON_AUTOINC, 0xA3, 0xFF,
    4, _NON_AUTOINC, 0xA4, 0x0F,
    4, _NON_AUTOINC, 0xA5, 0xFF,
    4, _NON_AUTOINC, 0xA6, 0x03,
    4, _NON_AUTOINC, 0xA7, 0xFF,
    4, _NON_AUTOINC, 0xA8, 0x03,
    4, _NON_AUTOINC, 0xA9, 0xFF,
    4, _NON_AUTOINC, 0xAA, 0x0F,
    4, _NON_AUTOINC, 0xAB, 0xFF,
    4, _NON_AUTOINC, 0xAC, 0x3F,
    4, _NON_AUTOINC, 0xAD, 0xFF,
    4, _NON_AUTOINC, 0xAE, 0x3F,
    4, _NON_AUTOINC, 0xAF, 0xFF,
    4, _NON_AUTOINC, 0xB0, 0x3F,
    4, _NON_AUTOINC, 0xB1, 0xFF,
    4, _NON_AUTOINC, 0xB2, 0x03,
    4, _NON_AUTOINC, 0xB3, 0xFF,
    4, _NON_AUTOINC, 0xB4, 0x03,
    4, _NON_AUTOINC, 0xB5, 0xFF,
    4, _NON_AUTOINC, 0xB6, 0x03,
    4, _NON_AUTOINC, 0xB7, 0xFF,

    _END
};

BYTE code tQC_CONV_YUV2RGB_TABLE5[] =
{
    4, _NON_AUTOINC, 0x9F, 0x14,
    4, _NON_AUTOINC, 0xA1, 0x05,
    4, _NON_AUTOINC, 0xA2, 0x04,
    4, _NON_AUTOINC, 0xA3, 0x00,
    4, _NON_AUTOINC, 0xA4, 0x06,
    4, _NON_AUTOINC, 0xA5, 0x4D,
    4, _NON_AUTOINC, 0xA6, 0x00,
    4, _NON_AUTOINC, 0xA7, 0xC0,
    4, _NON_AUTOINC, 0xA8, 0x01,
    4, _NON_AUTOINC, 0xA9, 0xDF,
    4, _NON_AUTOINC, 0xAA, 0x07,
    4, _NON_AUTOINC, 0xAB, 0x6C,
    4, _NON_AUTOINC, 0xAC, 0x3C,
    4, _NON_AUTOINC, 0xAD, 0x00,
    4, _NON_AUTOINC, 0xAE, 0x3C,
    4, _NON_AUTOINC, 0xAF, 0x00,
    4, _NON_AUTOINC, 0xB0, 0x3C,
    4, _NON_AUTOINC, 0xB1, 0x00,
    4, _NON_AUTOINC, 0xB2, 0x02,
    4, _NON_AUTOINC, 0xB3, 0x54,
    4, _NON_AUTOINC, 0xB4, 0x02,
    4, _NON_AUTOINC, 0xB5, 0x54,
    4, _NON_AUTOINC, 0xB6, 0x02,
    4, _NON_AUTOINC, 0xB7, 0x54,

    _END
};

// -----------CRC Table of Color Conversion------------
BYTE code tDCOLORCONV_CRC_TABLE_0[] = {
    0xB0, 0x58, 0x06, 0x46, 0xC5, 0x40,
};

BYTE code tDCOLORCONV_CRC_TABLE_1[] = { //
    0x8E, 0xC4, 0x8E, 0x4B, 0x4A, 0x9B,
};

BYTE code tDCOLORCONV_CRC_TABLE_2[] = {
    0x43, 0x6E, 0x31, 0xC8, 0x0A, 0x94,
};

BYTE code tDCOLORCONV_CRC_TABLE_3[] = {
    0xD6, 0x71, 0x7A, 0x8B, 0x80, 0x3E,
};

BYTE code tDCOLORCONV_CRC_TABLE_4[] = {
    0xD8, 0xC0, 0x41, 0xF5, 0x4E, 0xC1,
};

BYTE code tDCOLORCONV_CRC_TABLE_5[] = {
    0xFD, 0x1F, 0x3B, 0x09, 0x88, 0x7F,
};

//--------------------------------------------------
// Description  : D Domain Dither Table 14 -> 8 Setting
// Input Value  : None
// Output Value : None
//--------------------------------------------------
BYTE code tQC_D_DOMAIN_DITHER_10_6_TABLE[] =
{
    0x07, 0xF8, 0x69, 0x1E, 0xAD, 0x52, 0xC3, 0xB4,
    0xAD, 0x52, 0xC3, 0xB4, 0x07, 0xF8, 0x69, 0x1E,
    0xAD, 0x52, 0x69, 0x1E, 0xC3, 0xB4, 0x07, 0xF8,
};

//--------------------------------------------------
// Description  : D Domain Dither Table 14 -> 10 Setting
// Input Value  : None
// Output Value : None
//--------------------------------------------------
BYTE code tQC_D_DOMAIN_DITHER_10_8_TABLE[] =
{
    0x01, 0x32, 0x12, 0x03, 0x23, 0x10, 0x30, 0x21,
    0x23, 0x10, 0x30, 0x21, 0x01, 0x32, 0x12, 0x03,
    0x30, 0x21, 0x01, 0x32, 0x12, 0x03, 0x23, 0x10,
};

//--------------------------------------------------
// Description  : D Domain Dither Sequence Table Setting
// Input Value  : None
// Output Value : None
//--------------------------------------------------
BYTE code tQC_D_DOMAIN_DITHER_SEQ_TABLE[] =
{
    0xE4, 0xA2, 0x05, 0x37, 0xF6, 0x31, 0x69, 0xCB, 0x1F, 0xD2, 0xB0, 0xE6,
    0x45, 0x1B, 0x87, 0xC6, 0x9E, 0xB4, 0xC6, 0x38, 0xD4, 0xDB, 0x12, 0x1B,

    0x63, 0x27, 0x93, 0x1E, 0x36, 0x2D, 0xD8, 0x4E, 0x36, 0x2D, 0xD2, 0x39,
    0x1E, 0x8D, 0x39, 0x87, 0x36, 0xB1, 0x9C, 0xD2, 0x87, 0x27, 0x1B, 0xD8,

    0xE1, 0xF7, 0xE6, 0xB7, 0x27, 0xB9, 0x8C, 0x8E, 0xD2, 0xEB, 0x3C, 0xA6,
    0x30, 0x56, 0xAD, 0xC6, 0x61, 0xFB, 0xCB, 0x39, 0x6C, 0x5D, 0x03, 0x02,

    0xD2, 0xD8, 0x93, 0xB4, 0x2D, 0x39, 0x9C, 0x2D, 0xC9, 0x4B, 0xD2, 0x87,
    0x27, 0xE1, 0xC6, 0x93, 0x2D, 0x9C, 0xD8, 0xC6, 0x1B, 0x36, 0x93, 0x1E,
};

//--------------------------------------------------
// Description  : D Domain Dither Sequence Table Setting
// Input Value  : None
// Output Value : None
//--------------------------------------------------
BYTE code tQC_DITHER_TEMOFFSET[] =
{
    0xE4, 0xE4, 0xE4, 0xE4,
};

BYTE code tQC_DDITHER_CRCTABLE_0[] =
{
    0x85, 0x59, 0x1B, 0xA1, 0x14, 0xFA,
    0x34, 0xE7, 0x32, 0x20, 0xF4, 0xE2,
    0x41, 0x50, 0x5D, 0xB6, 0xB2, 0xC2,
    0x66, 0x86, 0x44, 0x6E, 0x5F, 0x50,
    0xD1, 0xBF, 0xBC, 0x19, 0x91, 0x32,
    0xB1, 0x28, 0x04, 0x87, 0x0D, 0x07,
    0x86, 0x97, 0x1C, 0x12, 0x14, 0xE7,
    0x2A, 0x5E, 0x34, 0x61, 0xBB, 0x99,
    0x05, 0xF5, 0xA3, 0x8D, 0xD5, 0xFE,
    0x81, 0x77, 0xED, 0x62, 0xC7, 0xA7,
    0x3F, 0x3B, 0x2C, 0xC9, 0x23, 0x28,
    0x6A, 0x2A, 0x82, 0x0C, 0x6D, 0xB0,
    0x5E, 0x46, 0x81, 0xC6, 0x48, 0xFC,
    0xDE, 0x22, 0xE6, 0x93, 0x75, 0x99,
    0x35, 0xB9, 0x68, 0x19, 0xA0, 0x28,
    0x23, 0x9D, 0x41, 0x42, 0x67, 0x56,
    0xC0, 0x28, 0x7F, 0xE0, 0xA2, 0x08,
    0x67, 0x41, 0x4D, 0x7A, 0xBA, 0x1C,
    0xBD, 0x40, 0x09, 0xE6, 0x0F, 0x32,
    0x91, 0x85, 0xDD, 0x10, 0xC0, 0x5F,
    0xDD, 0xD9, 0xC9, 0xEF, 0x35, 0x5A,
    0x77, 0x84, 0x1C, 0x4C, 0x99, 0x53,
    0x8B, 0xB2, 0xEC, 0xBD, 0xC3, 0x39,
    0x92, 0x82, 0xFD, 0x10, 0x7D, 0xED,
    0x85, 0x59, 0x1B, 0xA1, 0x14, 0xFA,
};

BYTE code tQC_DDITHER_CRCTABLE_1[] =
{
    0x92, 0x82, 0xFD, 0x10, 0x7D, 0xED,
    0x92, 0x82, 0xFD, 0x10, 0x7D, 0xED,
    0x92, 0x82, 0xFD, 0x10, 0x7D, 0xED,
    0x66, 0x86, 0x44, 0x6E, 0x5F, 0x50,
    0x66, 0x86, 0x44, 0x6E, 0x5F, 0x50,
    0x66, 0x86, 0x44, 0x6E, 0x5F, 0x50,
    0x66, 0x86, 0x44, 0x6E, 0x5F, 0x50,
    0x92, 0x82, 0xFD, 0x10, 0x7D, 0xED,
};

BYTE code tQC_DDITHER_CRCTABLE_2[] =
{
    0x86, 0x1D, 0x43, 0xF6, 0x95, 0x48,
    0xF3, 0x82, 0x2D, 0x99, 0x86, 0xCF,
    0x87, 0x1B, 0x76, 0xDC, 0x8A, 0xB1,
    0x3B, 0xFA, 0xD7, 0x6B, 0x7C, 0xAB,
    0x86, 0x1D, 0x43, 0xF6, 0x95, 0x48,
};

BYTE code tYPEAKING_CRC_TABLE0[] =
{
    0x6B, 0x41, 0x9E, 0x02, 0x91, 0x0B,
};

BYTE code tYPEAKING_CRC_TABLE1[] =
{
    0x9D, 0x0C, 0x2F, 0xA0, 0xF0, 0x99,
};

BYTE code tYPEAKING_CRC_TABLE2[] =
{
    0x7F, 0xB9, 0xA0, 0x83, 0x3A, 0x8A,
};

//****************************************************************************
// VARIABLE DECLARATIONS
//****************************************************************************


//****************************************************************************
// FUNCTION DECLARATIONS
//****************************************************************************
// Common Function
void ScalerQCVGATopRandomGenOn(bit bRandomSelect);
void ScalerQCVGATopRandomGenOff(void);
void ScalerQCIDomainRandomGenOn(bit bRandomSelect);
void ScalerQCIDomainRandomGenOff(void);
void ScalerQCHighlightWindowOn(void);
void ScalerQCHighlightWindowOff(void);
void ScalerQCDDomainPatternGenOff(void);
void ScalerQCDDomainRandomGenOn(bit bRandomSelect);
void ScalerQCDDomainPatternGenOn(void);

bit ScalerQCVGAPGTest(void);
bit ScalerQCADCNRTest(void);
bit ScalerQCRingingFilterTest(void);
bit ScalerQCDigitalFilterTest(void);

// I-domain
bit ScalerQC422to444Test(void);
bit ScalerQCIPGTest(void);
bit ScalerQCIDomainColorConvTest(void);
bit ScalerQCIDitherTest(void);
bit ScalerQCScaleDownTest(void);

// D-domain
bit ScalerQCLSRTest(void);
bit ScalerQCScaleUpTest(void);
bit ScalerQCHLWTest(void);

bit ScalerQCDPGTest(void);
bit ScalerQCDPGRandomTest(void);

bit ScalerQCPCMTest(void);
void ScalerQCPCMOff(void);
bit ScalerQCsRGBTest(void);
void ScalerQCsRGBOff(void);
bit ScalerQCGammaTest(void);
void ScalerQCGammaOff(void);
bit ScalerQCBackGroundColor(void);

bit ScalerQCDCRTest(void);
bit ScalerQCDCCTest(void);
bit ScalerQCICMTest(void);
bit ScalerQCCTSBRITest(void);

bit ScalerQCDDomainColorConvTest(void);
bit ScalerQCYPeakingTest(void);
bit ScalerQCDDitherTest(void);

//****************************************************************************
// FUNCTION DEFINITIONS
//****************************************************************************
//----------------------------------------------------------------------------
// Color Function Test
//----------------------------------------------------------------------------
//--------------------------------------------------
// Description  : Test VGA Random Generator
// Input Value  : None
// Output Value : None
//--------------------------------------------------
bit ScalerQCVGAPGTest(void)
{
    BYTE ucFlag = 0;
    DebugMessageQC("5. VGA PG Start", 0x00);

    ScalerQCVGATopRandomGenOn(_GRAY);
    ucFlag = (ucFlag | ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tVGAPG_CRC_TABLE0, 1) << 0));

    ScalerQCVGATopRandomGenOn(_MASS);
    ucFlag = (ucFlag | ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tVGAPG_CRC_TABLE1, 1) << 1));

    DebugMessageQC("5. VGA PG End", 0x00);

    ScalerQCVGATopRandomGenOff();

    if(ucFlag == _TEST_PASS)
    {
        DebugMessageQC("6.VGA PG PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6.VGA PG Fail", ucFlag);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : ADCNR Test
// Input Value  : None
// Output Value : None
//--------------------------------------------------
bit ScalerQCADCNRTest(void)
{
    BYTE ucData = 0;

    DebugMessageQC("5. ADCNR Start", 0x00);

    ScalerQCVGATopRandomGenOn(_GRAY);

    ScalerSetByte(P33_01_ADCNR_CTRL2, 0x37);
    ScalerSetByte(P33_02_ADCNR_CTRL3, 0x76);
    ScalerSetByte(P33_00_ADCNR_CTRL1, 0x9C); // Enable ADCNR

    ScalerTimerDelayXms(300); // Wait over 7frames

    DebugMessageQC("5. Mode_0", 0x00);
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tADCNR_CRC_TABLE0, 1) << 0);

    ScalerSetByte(P33_00_ADCNR_CTRL1, 0x1C); // Disable ADCNR
    ScalerSetBit(P33_02_ADCNR_CTRL3, ~(_BIT7 | _BIT6), 0x00);       // No Truncate LSB

    ScalerQCVGATopRandomGenOff();

    DebugMessageQC("5.ADCNR End", 0x00);

    if(ucData == 0x00)
    {
        DebugMessageQC("6.ADCNR PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucData);
        DebugMessageQC("6.ADCNR FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : RingingFilter Test
// Input Value  : None
// Output Value : None
//--------------------------------------------------
bit ScalerQCRingingFilterTest(void)
{
    BYTE ucData = 0;

    DebugMessageQC("5. Ringing Filter Start", 0x00);

    ScalerQCVGATopRandomGenOn(_MASS);

    ScalerSetByte(P25_A0_RFILTER_CTRL, 0xE0);
    ScalerSetByte(P25_A1_RFILTER_THD, 0x23);
    ScalerSetByte(P25_A2_RFILTER_THD_RNG_EXP, 0x04);
    ScalerSetByte(P25_A3_RFILTER_OFS_COEF, 0x0C);
    ScalerSetByte(P25_A4_RFILTER_OFS_RNG_EXP, 0x04);
    ScalerSetByte(P25_A5_RFILTER_DIFF_THD_UB, 0x01);
    ScalerSetByte(P25_A6_RFILTER_DIFF_THD_LB, 0x01);
    ScalerSetByte(P25_A7_RFILTER_FACTOR_TEST_CTRL, 0x00);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_0", 0x00);  // normal
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tRingingFilterTest0_ICRCTable, 1) << 0);

    ScalerSetByte(P25_A0_RFILTER_CTRL, 0xC0);
    ScalerSetByte(P25_A1_RFILTER_THD, 0x23);
    ScalerSetByte(P25_A2_RFILTER_THD_RNG_EXP, 0x04);
    ScalerSetByte(P25_A3_RFILTER_OFS_COEF, 0x0C);
    ScalerSetByte(P25_A4_RFILTER_OFS_RNG_EXP, 0x04);
    ScalerSetByte(P25_A5_RFILTER_DIFF_THD_UB, 0x01);
    ScalerSetByte(P25_A6_RFILTER_DIFF_THD_LB, 0x01);
    ScalerSetByte(P25_A7_RFILTER_FACTOR_TEST_CTRL, 0x00);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_1", 0x00);  // disable JumpJudgment En
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tRingingFilterTest1_ICRCTable, 1) << 1);

    ScalerSetByte(P25_A0_RFILTER_CTRL, 0xE0);
    ScalerSetByte(P25_A1_RFILTER_THD, 0x23);
    ScalerSetByte(P25_A2_RFILTER_THD_RNG_EXP, 0x04);
    ScalerSetByte(P25_A3_RFILTER_OFS_COEF, 0x0C);
    ScalerSetByte(P25_A4_RFILTER_OFS_RNG_EXP, 0x04);
    ScalerSetByte(P25_A5_RFILTER_DIFF_THD_UB, 0x01);
    ScalerSetByte(P25_A6_RFILTER_DIFF_THD_LB, 0x01);
    ScalerSetByte(P25_A7_RFILTER_FACTOR_TEST_CTRL, 0x07);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_2", 0x00);  // Enable Factor=1
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tRingingFilterTest2_ICRCTable, 1) << 2);

    ScalerSetByte(P25_A0_RFILTER_CTRL, 0xA0);
    ScalerSetByte(P25_A1_RFILTER_THD, 0x50);
    ScalerSetByte(P25_A2_RFILTER_THD_RNG_EXP, 0x04);
    ScalerSetByte(P25_A3_RFILTER_OFS_COEF, 0x0C);
    ScalerSetByte(P25_A4_RFILTER_OFS_RNG_EXP, 0x04);
    ScalerSetByte(P25_A5_RFILTER_DIFF_THD_UB, 0x00);
    ScalerSetByte(P25_A6_RFILTER_DIFF_THD_LB, 0x01);
    ScalerSetByte(P25_A7_RFILTER_FACTOR_TEST_CTRL, 0x00);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_3", 0x00);  // Fixing Offset Range
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tRingingFilterTest3_ICRCTable, 1) << 3);

    ScalerSetByte(P25_A0_RFILTER_CTRL, 0xA0);
    ScalerSetByte(P25_A1_RFILTER_THD, 0xB4);
    ScalerSetByte(P25_A2_RFILTER_THD_RNG_EXP, 0x04);
    ScalerSetByte(P25_A3_RFILTER_OFS_COEF, 0x06);
    ScalerSetByte(P25_A4_RFILTER_OFS_RNG_EXP, 0x04);
    ScalerSetByte(P25_A5_RFILTER_DIFF_THD_UB, 0x01);
    ScalerSetByte(P25_A6_RFILTER_DIFF_THD_LB, 0x01);
    ScalerSetByte(P25_A7_RFILTER_FACTOR_TEST_CTRL, 0x00);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_4", 0x00);  // big threshold, small offset Coef, DiffThreshold_UB/LB
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tRingingFilterTest4_ICRCTable, 1) << 4);

    ScalerSetByte(P25_A0_RFILTER_CTRL, 0xE0);
    ScalerSetByte(P25_A1_RFILTER_THD, 0x14);
    ScalerSetByte(P25_A2_RFILTER_THD_RNG_EXP, 0x02);
    ScalerSetByte(P25_A3_RFILTER_OFS_COEF, 0x12);
    ScalerSetByte(P25_A4_RFILTER_OFS_RNG_EXP, 0x04);
    ScalerSetByte(P25_A5_RFILTER_DIFF_THD_UB, 0x01);
    ScalerSetByte(P25_A6_RFILTER_DIFF_THD_LB, 0x01);
    ScalerSetByte(P25_A7_RFILTER_FACTOR_TEST_CTRL, 0x08);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_5", 0x00);  // Enable DiffFactor=0 when pixels=2
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tRingingFilterTest5_ICRCTable, 1) << 5);

    ScalerSetByte(P25_A0_RFILTER_CTRL, 0xB0);
    ScalerSetByte(P25_A1_RFILTER_THD, 0x96);
    ScalerSetByte(P25_A2_RFILTER_THD_RNG_EXP, 0x04);
    ScalerSetByte(P25_A3_RFILTER_OFS_COEF, 0x02);
    ScalerSetByte(P25_A4_RFILTER_OFS_RNG_EXP, 0x04);
    ScalerSetByte(P25_A5_RFILTER_DIFF_THD_UB, 0x00);
    ScalerSetByte(P25_A6_RFILTER_DIFF_THD_LB, 0x01);
    ScalerSetByte(P25_A7_RFILTER_FACTOR_TEST_CTRL, 0x04);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_6", 0x00);  // big threshold, small coef, R disable, THD_Factor=1
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tRingingFilterTest6_ICRCTable, 1) << 6);

    ScalerSetByte(P25_A0_RFILTER_CTRL, 0xC0);
    ScalerSetByte(P25_A1_RFILTER_THD, 0x50);
    ScalerSetByte(P25_A2_RFILTER_THD_RNG_EXP, 0x04);
    ScalerSetByte(P25_A3_RFILTER_OFS_COEF, 0x1E);
    ScalerSetByte(P25_A4_RFILTER_OFS_RNG_EXP, 0x04);
    ScalerSetByte(P25_A5_RFILTER_DIFF_THD_UB, 0x00);
    ScalerSetByte(P25_A6_RFILTER_DIFF_THD_LB, 0x01);
    ScalerSetByte(P25_A7_RFILTER_FACTOR_TEST_CTRL, 0x00);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_7", 0x00);  // big coef
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tRingingFilterTest7_ICRCTable, 1) << 7);

    ScalerSetByte(P25_A0_RFILTER_CTRL, 0x00); // Disable Ringing Filter

    ScalerQCVGATopRandomGenOff();

    DebugMessageQC("5.Ringing Filter End", 0x00);

    if(ucData == 0x00)
    {
        DebugMessageQC("6. Ringing Filter PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucData);
        DebugMessageQC("6. Ringing Filter FAIL", 0x00);
        return _TEST_FAIL;
    }

}

//--------------------------------------------------
// Description  : DigitalFilter Test
// Input Value  : None
// Output Value : None
//--------------------------------------------------
bit ScalerQCDigitalFilterTest(void)
{
    WORD usData = 0;

    DebugMessageQC("5. Digital Filter Start", 0x00);
    ScalerQCVGATopRandomGenOn(_MASS);

    // reset regs
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x10); // Enable Phase subFunction
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x20);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale negative semar sunFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x30);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale positive semar sunFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x40);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale negative ringing subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x50);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale positive ringing subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x60);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale mismatch subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x70);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale mismatch subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x80);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale Noise Reduction subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x90); // Set Old Phase Threshold
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00);

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x11);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // disable New Phase Mode EN
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x21);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x31);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x41);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x51);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x61);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x71);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x81);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x91);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0xA1);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00);

    // mode start
    //Digital Filter For Phase
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x70); // Digital Filter Coefficient
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xF0);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x10); // Enable Phase subFunction
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x80);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x11);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // disable New Phase Mode EN
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x90); // Set Old Phase Threshold
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x32);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_0", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest0_ICRCTable, 1) << 0));

    //Digital Filter For Other Sub-Function(disable)

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x10);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x80); // Disbale Phase subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x20);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xD4); // Enable negative semar sunFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x30);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xD8); // Enable positive semar sunFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x40);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xDC); // Enable negative ringing subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x50);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xD0); // Enable positive ringing subFunction (0xd0:80   0xb0:48)
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x60);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x80); // Enable mismatch subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x80);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x90); // Enable Noise Reduction subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x90); // Set Old Phase Threshold
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x32);

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x02);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_1", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest1_ICRCTable, 1) << 1));


    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x80);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xE0); // Enable Noise Reduction subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x00); // only reduce ringing condition + mismatch

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_2", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest2_ICRCTable, 1) << 2));

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x02); // only reduce smear condition + mismatch

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_3", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest3_ICRCTable, 1) << 3));

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x10);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale Phase subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x20);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x94); // Enable negative semar sunFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x30);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xA8); // Enable positive semar sunFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x40);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xBC); // Enable negative ringing subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x50);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xB0); // Enable positive ringing subFunction (0xd0:80   0xb0:48)
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x60);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x80); // Enable mismatch subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x80);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x90); // Enable Noise Reduction subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x90); // Set Old Phase Threshold
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x32);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x06);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_4", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest4_ICRCTable, 1) << 4));

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x0A); // disable + noise reduction

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_5", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest5_ICRCTable, 1) << 5));

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x0E);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_6", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest6_ICRCTable, 1) << 6));

    //Digital Filter For NEW Phase
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x10); // Enable Phase subFunction
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x80);
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x20);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale negative semar sunFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x30);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale positive semar sunFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x40);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale negative ringing subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x50);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale positive ringing subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x60);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale mismatch subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x80);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Disbale Noise Reduction subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x90); // Set Old Phase Threshold
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x32);

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x11);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x80); // New Phase Mode EN
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x21);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x1E); // Threshold Of R
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x31);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x05); // Offset Of R
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x41);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x85); // Gain Of R

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x51);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x50); // Threshold Of G
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x61);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x07); // Offset Of G
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x71);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x05); // Gain Of G

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x81);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x01); // Threshold Of B
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x91);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x01); // Offset Of B
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0xA1);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xFF); // Gain Of B
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x00);

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_7", 0x00);  // Double Side + Double Gain
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest7_ICRCTable, 1) << 7));

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x11);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xC0); // Single Side + Double Gain
    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_8", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest8_ICRCTable, 1) << 8));

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x11);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xA0); // Double Side + Single Gain
    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_9", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest9_ICRCTable, 1) << 9));

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x11);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xE0); // Single Side + Single Gain
    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_10", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest10_ICRCTable, 1) << 10));


    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x10);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x80); // Enable Phase subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x20);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x90); // Enable negative semar sunFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x30);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xA4); // Enable positive semar sunFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x40);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xB8); // Enable negative ringing subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x50);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xBC); // Enable positive ringing subFunction (0xd0:80   0xb0:48)
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x60);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x80); // Enable mismatch subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x80);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xE0); // Enable Noise Reduction subFunction

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x11);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x80); // New Phase Mode EN

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x04); // only reduce ringing condition

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_11", 0x00);  // Double Side + Double Gain + other function
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest11_ICRCTable, 1) << 11));

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x40);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x38); // Disable negative ringing subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x50);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x3C); // Disable positive ringing subFunction (0xd0:80   0xb0:48)

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x11);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xC0);

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x41);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x19); //

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x81);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x10); //

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x00); // disable Two condition occur continuous (ringing to smear)

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_12", 0x00);  // Double Side + Single Gain + other function
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest12_ICRCTable, 1) << 12));

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x40);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xB8); // Enable negative ringing subFunction
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x50);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xBC); // Enable positive ringing subFunction (0xd0:80   0xb0:48)

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x11);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0xA0); // Single Side + Double Gain + other function

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x41);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x85); //

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x81);
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x01); //

    ScalerTimerDelayXms(50);
    DebugMessageQC("5. Mode_13", 0x00);  // Double Side + Double Gain + other function
    usData = (usData | ((WORD)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tDigitalFilterTest13_ICRCTable, 1) << 13));

    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x70); // Disable Digital Filter
    ScalerSetByte(P0_99_DIGITAL_FILTER_PORT,0x00); // Y/Pb/Pr Function Disable //Initial Value=0
    ScalerSetByte(P0_98_DIGITAL_FILTER_CTRL,0x00); // Disable Digital Filter

    ScalerQCVGATopRandomGenOff();

    DebugMessageQC("5. Digital Filter End", 0x00);

    if(usData == 0x0000)
    {
        DebugMessageQC("6. Digital Filter PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", usData);
        DebugMessageQC("6. Digital Filter FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : 422to444 Test
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQC422to444Test(void)
{
    BYTE ucData = 0;

    DebugMessageQC("5. 422to444 Start", 0x00);
    ScalerQCIDomainRandomGenOn(_MASS);

    // 0.
    ScalerSetByte(P31_40_YUV422_TO_444_PATH0, 0x08);
    DebugMessageQC("5. Mode_0", 0x00);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_IDITHER, t422to444_Table0, 1) << 0);

    // 1.
    ScalerSetByte(P31_40_YUV422_TO_444_PATH0, 0x0B);
    DebugMessageQC("5. Mode_1", 0x00);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_IDITHER, t422to444_Table1, 1) << 1);

    // 2.
    ScalerSetByte(P31_40_YUV422_TO_444_PATH0, 0x0E);
    DebugMessageQC("5. Mode_2", 0x00);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_IDITHER, t422to444_Table2, 1) << 2);

    // Disable 422to444
    ScalerSetByte(P31_40_YUV422_TO_444_PATH0, 0x00);

    ScalerQCIDomainRandomGenOff();
    DebugMessageQC("5. 422to444 End", 0x00);

    if(ucData == _TEST_PASS)
    {
        DebugMessageQC("6.422to444 PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6.422to444 Fail", 0x00);
        return _TEST_FAIL;
    }

}

//--------------------------------------------------
// Description  : Test I-Domain Random Generator
// Input Value  : None
// Output Value : None
//--------------------------------------------------
bit ScalerQCIPGTest(void)
{
    BYTE ucFlag = 0;
    DebugMessageQC("5. IPG Start", 0x00);
    ScalerQCIDomainRandomGenOn(_GRAY);

    ucFlag = ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tIPG_CRC_TABLE, 1) << 0);

    ScalerQCIDomainRandomGenOn(_MASS);

    ucFlag = ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_VGIP, tIPG_CRC_TABLE1, 1) << 1);

    DebugMessageQC("5. IPG End", 0x00);

    ScalerQCIDomainRandomGenOff();

    if(ucFlag == _TEST_PASS)
    {
        DebugMessageQC("6.====IPG PASS====", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6.====IPG Fail====", ucFlag);
        return _TEST_FAIL;
    }
}

//----------------------------------------------------------------------------
// I-Domain Color Conversion Test
//----------------------------------------------------------------------------
bit ScalerQCIDomainColorConvTest(void)
{
    BYTE ucResult = _TEST_PASS;

    ////////////////////////////////////////////////////////////////////
    // RGB -> YCbCr                                                   //
    ////////////////////////////////////////////////////////////////////
    DebugMessageQC("5. I-Domain Color Conversion Start", 0x00);

    // case 0
    ScalerQCIDomainRandomGenOn(_MASS);
    ScalerBurstWrite(tQC_CONV_RGB2YUV_TABLE0, sizeof(tQC_CONV_RGB2YUV_TABLE0), GET_CURRENT_BANK_NUMBER(), P0_9D_RGB2YCC_COEF_DATA, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);

    ScalerTimerWaitForEvent(_EVENT_IVS);
    ScalerTimerWaitForEvent(_EVENT_IVS);

    DebugMessageQC("5. Color Conv case0", 0x00);
    ucResult = ucResult | ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_IDITHER, tICOLORCONV_CRC_TABLE0, 1));

    // case 1
    ScalerQCIDomainRandomGenOn(_MASS);
    ScalerBurstWrite(tQC_CONV_RGB2YUV_TABLE1, sizeof(tQC_CONV_RGB2YUV_TABLE1), GET_CURRENT_BANK_NUMBER(), P0_9D_RGB2YCC_COEF_DATA, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);

    ScalerTimerWaitForEvent(_EVENT_IVS);
    ScalerTimerWaitForEvent(_EVENT_IVS);

    DebugMessageQC("5. Color Conv case1", 0x00);
    ucResult = ucResult | ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_IDITHER, tICOLORCONV_CRC_TABLE1, 1));

    // case 2
    ScalerQCIDomainRandomGenOn(_MASS);
    ScalerBurstWrite(tQC_CONV_RGB2YUV_TABLE2, sizeof(tQC_CONV_RGB2YUV_TABLE2), GET_CURRENT_BANK_NUMBER(), P0_9D_RGB2YCC_COEF_DATA, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);

    ScalerTimerWaitForEvent(_EVENT_IVS);
    ScalerTimerWaitForEvent(_EVENT_IVS);

    DebugMessageQC("5. Color Conv case2", 0x00);
    ucResult = ucResult | ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_IDITHER, tICOLORCONV_CRC_TABLE2, 1));

    // case 3
    ScalerQCIDomainRandomGenOn(_MASS);
    ScalerBurstWrite(tQC_CONV_RGB2YUV_TABLE3, sizeof(tQC_CONV_RGB2YUV_TABLE3), GET_CURRENT_BANK_NUMBER(), P0_9D_RGB2YCC_COEF_DATA, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);

    ScalerTimerWaitForEvent(_EVENT_IVS);
    ScalerTimerWaitForEvent(_EVENT_IVS);

    DebugMessageQC("5. Color Conv case3", 0x00);
    ucResult = ucResult | ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_IDITHER, tICOLORCONV_CRC_TABLE3, 1));

    // case 4
    ScalerQCIDomainRandomGenOn(_MASS);
    ScalerBurstWrite(tQC_CONV_RGB2YUV_TABLE4, sizeof(tQC_CONV_RGB2YUV_TABLE4), GET_CURRENT_BANK_NUMBER(), P0_9D_RGB2YCC_COEF_DATA, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);

    ScalerTimerWaitForEvent(_EVENT_IVS);
    ScalerTimerWaitForEvent(_EVENT_IVS);

    DebugMessageQC("5. Color Conv case4", 0x00);
    ucResult = ucResult | ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_IDITHER, tICOLORCONV_CRC_TABLE4, 1));

    // Disable YUV2RGB conversion
    ScalerSetByte(P0_9C_RGB2YCC_CTRL, 0x00);
    ScalerQCIDomainRandomGenOff();
    ScalerTimerWaitForEvent(_EVENT_IVS);

    DebugMessageQC("5. I-Domain Color Conversion End", 0x00);

    if(ucResult == 0)
    {
        DebugMessageQC("6. I-Domain Color Conversion PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucResult);
        DebugMessageQC("6. I-Domain Color Conversion FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : I Domain Dither Test
// Input Value  : None
// Output Value : None
//--------------------------------------------------
bit ScalerQCIDitherTest(void)
{
    BYTE ucData = 0;

    DebugMessageQC("5. I Dither Start", 0x00);

    ScalerQCIDomainRandomGenOn(_MASS);

    // 10 bit dither test
    DebugMessageQC("5. Mode_0", 0x00);
    ScalerTimerWaitForEvent(_EVENT_IEN_START);

    ScalerSetBit(P0_89_I_DITHER_COMMON_CTRL1_SETA, ~(_BIT7 | _BIT6), _BIT7);
    ScalerBurstWrite(tQC_I_DOMAIN_DITHER_12_10_TABLE, 24, GET_CURRENT_BANK_NUMBER(), P0_88_I_DITHER_DATA_ACCESS_SETA, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);

    ScalerSetBit(P0_89_I_DITHER_COMMON_CTRL1_SETA, ~(_BIT7 | _BIT6), _BIT6);
    ScalerBurstWrite(tQC_I_DOMAIN_DITHER_SEQ_TABLE, 24, GET_CURRENT_BANK_NUMBER(), P0_88_I_DITHER_DATA_ACCESS_SETA, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);

    ScalerSetBit(P0_89_I_DITHER_COMMON_CTRL1_SETA, ~(_BIT7 | _BIT6), (_BIT7 | _BIT6));
    ScalerBurstWrite(tQC_I_DOMAIN_DITHER_TEMOFFSET, 4, GET_CURRENT_BANK_NUMBER(), P0_88_I_DITHER_DATA_ACCESS_SETA, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);

    ScalerSetBit(P0_8A_I_DITHER_COMMON_CTRL2_SETA, 0x00, _BIT1);
    ScalerSetBit(P0_89_I_DITHER_COMMON_CTRL1_SETA, 0x00, _BIT5 | _BIT4 | _BIT1 | _BIT0);
    ucData = ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_IDITHER, tQC_IDITHER_CRCTable_P0, 5) << 0);

    // 8 bit dither test
    DebugMessageQC("5. Mode_1", 0x00);
    ScalerSetBit(P0_89_I_DITHER_COMMON_CTRL1_SETA, ~(_BIT7 | _BIT6), _BIT7);
    ScalerBurstWrite(tQC_I_DOMAIN_DITHER_12_8_TABLE, 24, GET_CURRENT_BANK_NUMBER(), P0_88_I_DITHER_DATA_ACCESS_SETA, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);

    ScalerSetBit(P0_89_I_DITHER_COMMON_CTRL1_SETA, 0x00, _BIT5 | _BIT3 | _BIT2);
    ScalerSetBit(P0_8A_I_DITHER_COMMON_CTRL2_SETA, 0x00, 0x00);
    ScalerTimerWaitForEvent(_EVENT_IVS);
    ucData = ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_IDITHER, tQC_IDITHER_CRCTable_P1, 1) << 1);

    ScalerSetByte(P0_89_I_DITHER_COMMON_CTRL1_SETA, 0x00);
    ScalerQCIDomainRandomGenOff();

    DebugMessageQC("5. I Dither End", 0x00);

    if(ucData == 0x00)
    {
        DebugMessageQC("6. I Dither PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucData);
        DebugMessageQC("6. I Dither FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : Scale Down Test
// Input Value  : None
// Output Value : None
//--------------------------------------------------
bit ScalerQCScaleDownTest(void)
{
    BYTE ucData = 0;

    DebugMessageQC("5. Scale down Start", 0x00);
    ScalerQCIDomainRandomGenOn(_MASS);

    //ucTemp[0] = ScalerGetByte(P0_19_M1_IPV_ACT_STA_L);

    // M1  VSD InitialPhase + Factor
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_00_V_SD_INIT_M1, 0x04);
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_01_V_SD_FACTOR_H_M1, 0x02);
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_02_V_SD_FACTOR_M_M1, 0x49);
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_03_V_SD_FACTOR_L_M1, 0x24);

    // M1 HSD InitialPhase + Factor
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_04_H_SD_INIT_M1, 0x04);
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_05_H_SD_FACTOR_H_M1, 0x12);
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_06_H_SD_FACTOR_M_M1, 0x49);
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_07_H_SD_FACTOR_L_M1, 0x24);

    // Enable H Scale Down
    // M1
    ScalerSetBit(P0_23_SCALE_DOWN_CTRL_M1, ~_BIT1, _BIT1);

    // Enable V Scale Down
    // M1
    ScalerSetBit(P0_23_SCALE_DOWN_CTRL_M1, ~_BIT0, _BIT0);

    DebugMessageQC("5. Mode_0", 0x00);
    ucData = (ucData | ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_SD, tScaleDownTest0_ICRCTable, 1) << 0));

    //LSB2bits is tied to 'b00
    // M1
    ScalerSetBit(P0_26_SD_FILTER_CONTROL_REG_M1, ~_BIT0, _BIT0);

    DebugMessageQC("5. Mode_1", 0x00);
    ucData = (ucData | ((BYTE)ScalerQCCRCCompare(_I_CRC_AFTER_SD, tScaleDownTest1_ICRCTable, 1) << 1));

    // M1
    ScalerSetBit(P0_26_SD_FILTER_CONTROL_REG_M1, ~_BIT0, 0x00);

    ScalerQCIDomainRandomGenOff();

     // Disable  Scale Down
    // M1
    ScalerSetBit(P0_23_SCALE_DOWN_CTRL_M1, ~(_BIT1 | _BIT0), 0x00);
    // M2
    //ScalerSetBit(P40_23_SCALE_DOWN_CTRL_M2, ~_BIT0, 0x00);

    DebugMessageQC("5. Scale down End", 0x00);

    if(ucData == 0x00)
    {
        DebugMessageQC("6. Scale down PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", 0x01);
        DebugMessageQC("6. Scale down FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : Highlight Window
// Input Value  : None
// Output Value : None
//--------------------------------------------------
bit ScalerQCHLWTest(void)
{
    BYTE ucData = 0;

    DebugMessageQC("5. Highlight Window Start", 0x00);
    ScalerQCDDomainRandomGenOn(_MASS);
    ScalerQCHighlightWindowOn();

    // Open Cts
    ScalerSetByte(P0_64_CTS_BRI_PORT_ADD, 0x00);
    ScalerBurstWrite(tQC_CON_BRI_HLW_SETTING, sizeof(tQC_CON_BRI_HLW_SETTING), GET_CURRENT_BANK_NUMBER(), P0_65_CTS_BRI_PORT_DATA, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);
    ScalerSetDataPortByte(P0_64_CTS_BRI_PORT_ADD, _P0_65_PT_26_CTS_BRI_SWAP, 0x00);
    ScalerSetBit(P0_62_SRGB_CTRL, ~_BIT1, _BIT1);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT7 | _BIT6), _BIT7 | _BIT6);

    // RandomGen + HLW(Four border);
    DebugMessageQC("5. Mode_0", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0C_HLW_BORDER_EN, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4), 0x00);
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tHLWTest0_DCRCTable, 1) << 0);

    // RandomGen + HLW(Bottom & Right border);
    DebugMessageQC("5. Mode_1", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0C_HLW_BORDER_EN, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4), (_BIT7 | _BIT5));
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tHLWTest1_DCRCTable, 1) << 1);

    // RandomGen + HLW(Top & Right border);
    DebugMessageQC("5. Mode_2", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0C_HLW_BORDER_EN, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4), (_BIT7 | _BIT4));
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tHLWTest2_DCRCTable, 1) << 2);

    // RandomGen + HLW(Top & Left border);
    DebugMessageQC("5. Mode_3", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0C_HLW_BORDER_EN, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4), (_BIT6 | _BIT4));
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tHLWTest3_DCRCTable, 1) << 3);

    // RandomGen + HLW(Bottom & Left border);
    DebugMessageQC("5. Mode_4", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0C_HLW_BORDER_EN, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4), (_BIT6 | _BIT5));
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tHLWTest4_DCRCTable, 1) << 4);

    ScalerQCDDomainPatternGenOff();
    ScalerQCHighlightWindowOff();
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0C_HLW_BORDER_EN, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4), 0x00);
    ScalerSetBit(P0_62_SRGB_CTRL, ~(_BIT1 | _BIT0), 0x00);

    DebugMessageQC("5. Highlight Window End", 0x00);
    if(ucData == 0x00)
    {
        DebugMessageQC("6. Highlight Window PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucData);
        DebugMessageQC("6. Highlight Window FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : LSR Test
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCLSRTest(void)
{
    BYTE ucData = 0;
    BYTE temp[9]=0;
    BYTE ucTemp = 0;

    DebugMessageQC("5. LSR Start", 0x00);

    ScalerQCIDomainRandomGenOn(_MASS);

    ScalerTimerWaitForEvent(_EVENT_IVS);
    ScalerTimerWaitForEvent(_EVENT_IVS);

    DebugMessageQC("M domain CRC Test!", 1);

    for(ucTemp=0; ucTemp < 3 ; ucTemp++)
    {
        if(ScalerQCCRCCompare(_M_CRC_AFTER_FIFO, tMDomain_Table, 1))
        {
            DebugMessageQC("M domain CRC fail!", ucTemp);
        }
    }

    ScalerSetBit(P0_35_FILTER_CONTROL_REG, ~(_BIT5 | _BIT4), _BIT4);
    ScalerSetBit(P0_37_SCALE_UP_FOR_LINE_INTERLEAVE, ~(_BIT5 | _BIT4), (_BIT5 | _BIT4));

    DebugMessageQC("5. Check SU mode0 D_CRC", 0x00);
    ucData = (ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tScaleUpTest2_DCRCTable, 1) << 0));

    ScalerBurstWrite(tQC_LSR_SETTING, 90, GET_CURRENT_BANK_NUMBER(), P14_C0_LSR_CTRL, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerBurstWrite(tQC_LSR_HLW, 15, GET_CURRENT_BANK_NUMBER(), P11_CC_LSR_HLW_H_START_HIGH, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);

    //0.LSR
    ScalerSetByte(P11_B9_SCALER_LSR_HLW, 0x00);
    DebugMessageQC("5. Mode_0", 0x00);
    ucData = (ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tLSR_Table0, 1) << 1));

    //1.LSR + HLW(_INSIDE_WINDOW)
    ScalerSetByte(P11_B9_SCALER_LSR_HLW, 0x80);
    DebugMessageQC("5. Mode_1", 0x00);
    ucData = (ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tLSR_Table1, 1) << 2));

    //2.LSR + HLW(_OUTSIDE_WINDOW)
    ScalerSetByte(P11_B9_SCALER_LSR_HLW, 0xC0);
    DebugMessageQC("5. Mode_2", 0x00);
    ucData = (ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tLSR_Table2, 1) << 3));

    // Disable LSR
    ScalerSetByte(P14_C0_LSR_CTRL, 0x00);
    // Disable LSR HLW
    ScalerSetByte(P11_B9_SCALER_LSR_HLW, 0x00);

    ScalerQCIDomainRandomGenOff();

    DebugMessageQC("5. LSR End", 0x00);

    if(ucData == 0x00)
    {
        DebugMessageQC("6.====LSR PASS====", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucData);
        DebugMessageQC("6.====LSR Fail====", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : ScaleUp Test
// Input Value  : None
// Output Value : TEST_PASS/TEST_FAIL
//--------------------------------------------------
bit ScalerQCScaleUpTest(void)
{
    BYTE ucData = 0;
    BYTE ucTemp = 0;

    DebugMessageQC("5. Scale Up Start", 0x00);

    ucData = 0;

    ScalerQCIDomainRandomGenOn(_MASS);

    ScalerTimerWaitForEvent(_EVENT_IVS);
    ScalerTimerWaitForEvent(_EVENT_IVS);

    DebugMessageQC("M domain CRC Test!",1);

    for(ucTemp=0; ucTemp < 3 ; ucTemp++)
    {
        if(ScalerQCCRCCompare(_M_CRC_AFTER_FIFO, tMDomain_Table, 1))
        {
            DebugMessageQC("M domain CRC fail!",ucTemp);
        }
    }

    // 2D 4Line VSU
    ScalerSetBit(P0_35_FILTER_CONTROL_REG, ~(_BIT7 | _BIT6), _BIT7);
    ScalerBurstWrite(tQC_SU_COEF0, _SU_TABLE_SIZE, GET_CURRENT_BANK_NUMBER(), P0_36_USER_DEF_FILTER_ACCESS_PORT, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_35_FILTER_CONTROL_REG, ~(_BIT7 | _BIT6), (_BIT7 | _BIT6));
    ScalerBurstWrite(tQC_SU_COEF1, _SU_TABLE_SIZE, GET_CURRENT_BANK_NUMBER(), P0_36_USER_DEF_FILTER_ACCESS_PORT, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);

    ScalerSetBit(P0_35_FILTER_CONTROL_REG, ~(_BIT5 | _BIT4), _BIT4);

    ScalerSetDataPortByte(P0_33_SF_ADDR_PORT, _P0_34_PT_11_VER_FILTER_COEF_INI, 0x80);
    ScalerSetDataPortByte(P0_33_SF_ADDR_PORT, _P0_34_PT_03_VER_SCALE_FACTOR_H, 0x0F);
    ScalerSetDataPortByte(P0_33_SF_ADDR_PORT, _P0_34_PT_04_VER_SCALE_FACTOR_M, 0x9A);
    ScalerSetDataPortByte(P0_33_SF_ADDR_PORT, _P0_34_PT_05_VER_SCALE_FACTOR_L, 0x93);

    ScalerSetDataPortByte(P0_33_SF_ADDR_PORT, _P0_34_PT_10_HOR_FILTER_COEF_INI, 0x80);
    ScalerSetDataPortByte(P0_33_SF_ADDR_PORT, _P0_34_PT_00_HOR_SCALE_FACTOR_H, 0x0C);
    ScalerSetDataPortByte(P0_33_SF_ADDR_PORT, _P0_34_PT_01_HOR_SCALE_FACTOR_M, 0x30);
    ScalerSetDataPortByte(P0_33_SF_ADDR_PORT, _P0_34_PT_02_HOR_SCALE_FACTOR_L, 0xC3);

    // Enable V Scale Up
    ScalerSetBit(P0_32_SCALE_CONTROL_REG, ~_BIT1, _BIT1);
    // Enable H Scale Up
    ScalerSetBit(P0_32_SCALE_CONTROL_REG, ~_BIT0, _BIT0);

    DebugMessageQC("5. Mode_0", 0x00);

    ucData = (ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tScaleUpTest0_DCRCTable, 1) << 0));

    // Hcoef sel = 2nd, Vcoef sel = 1st
    ScalerSetBit(P0_35_FILTER_CONTROL_REG, ~(_BIT5 | _BIT4), _BIT5);

    DebugMessageQC("5. Mode_1", 0x00);
    ucData = (ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tScaleUpTest1_DCRCTable, 1) << 1));

    // fix H coef, fix V coef
    ScalerSetBit(P0_35_FILTER_CONTROL_REG, ~(_BIT5 | _BIT4), _BIT4);
    ScalerSetBit(P0_37_SCALE_UP_FOR_LINE_INTERLEAVE, ~(_BIT5 | _BIT4), (_BIT5 | _BIT4));
    DebugMessageQC("5. Mode_2", 0x00);
    ucData = (ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tScaleUpTest2_DCRCTable, 1) << 2));

    ScalerSetBit(P0_37_SCALE_UP_FOR_LINE_INTERLEAVE, ~(_BIT5 | _BIT4), 0x00);
    ScalerQCIDomainRandomGenOff();


    DebugMessageQC("5. Scale Up End", 0x00);


    if(ucData == 0x00)
    {
        DebugMessageQC("6. Scale Up PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucData);
        DebugMessageQC("6. Scale Up FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : Enable VGATOP Random Generator
// Input Value  : bRandomSelect ---> 0: R = G = B, 1: R != G != B
// Output Value : None
//--------------------------------------------------
void ScalerQCVGATopRandomGenOn(bit bRandomSelect)
{
    // Set default initial value
    ScalerSetByte(P30_DF_VGATOP_PAT_GEN_RED_INI_L, 0x01);
    ScalerSetByte(P30_E0_VGATOP_PAT_GEN_GRN_INI_L, 0x01);
    ScalerSetByte(P30_E1_VGATOP_PAT_GEN_BLU_INI_L, 0x01);
    ScalerSetByte(P30_E2_VGATOP_PAT_GEN_INI_H, 0x00);
    ScalerSetByte(P30_E3_VGA_PATTERN_RESET, 0x00);

    if(bRandomSelect == _GRAY)
    {
       ScalerSetBit(P30_DD_VGATOP_PAT_GEN_CTRL0, ~_BIT6, 0x00);
    }
    else
    {
       ScalerSetBit(P30_DD_VGATOP_PAT_GEN_CTRL0, ~_BIT6, _BIT6);
    }

    ScalerSetBit(P30_A0_VGATOP_VGIP_CTRL, ~_BIT7, _BIT7);
}

//--------------------------------------------------
// Description  : Disable VGATOP Random Generator
// Input Value  : None
// Output Value : None
//--------------------------------------------------
void ScalerQCVGATopRandomGenOff(void)
{
    ScalerSetBit(P30_A0_VGATOP_VGIP_CTRL, ~_BIT7, 0x00);
}

//--------------------------------------------------
// Description  : Enable I Domain Random Generator
// Input Value  : bRandomSelect ---> 0: R = G = B, 1: R != G != B
// Output Value : None
//--------------------------------------------------
void ScalerQCIDomainRandomGenOn(bit bRandomSelect)
{
    if(bRandomSelect == _GRAY)
    {
       ScalerSetDataPortBit(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_10_I_PG_CTRL_0_M1, ~_BIT6, 0x00);
    }
    else
    {
       ScalerSetDataPortBit(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_10_I_PG_CTRL_0_M1, ~_BIT6, _BIT6);
    }

    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_12_INITIAL_R_L_M1, 0x01);
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_13_INITIAL_G_L_M1, 0x01);
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_14_INITIAL_B_L_M1, 0x01);
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_15_INITIAL_RGB_M_M1, 0x00);
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_16_INITIAL_RGB_H_M1, 0x00);
    ScalerSetDataPortByte(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_17_PATTERN_RESET_M1, 0x00);
    ScalerSetBit(P0_10_M1_VGIP_CTRL, ~_BIT7, _BIT7);
}

//--------------------------------------------------
// Description  : Disable I Domain Random Generator
// Input Value  : None
// Output Value : None
//--------------------------------------------------
void ScalerQCIDomainRandomGenOff(void)
{
    ScalerSetDataPortBit(P0_24_SD_ADDRESS_PORT_M1, _P0_25_PT_10_I_PG_CTRL_0_M1, ~_BIT6, 0x00);
    ScalerSetBit(P0_24_SD_ADDRESS_PORT_M1, ~(_BIT6 | _BIT5 | _BIT4 | _BIT3 | _BIT2 | _BIT1 | _BIT0), 0x00);

    ScalerSetBit(P0_10_M1_VGIP_CTRL, ~_BIT7, 0x00);
}

//--------------------------------------------------
// Description  : Enable Highlight Window
// Input Value  : None
// Output Value : None
//--------------------------------------------------
void ScalerQCHighlightWindowOn(void)
{
    ScalerSetByte(P0_60_HLW_ADDR_PORT, 0x00);

    ScalerBurstWrite(tQC_HIGHLIGHT_WINDOW_SETTING, sizeof(tQC_HIGHLIGHT_WINDOW_SETTING), GET_CURRENT_BANK_NUMBER(), P0_61_HLW_DATA_PORT, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0C_HLW_BORDER_EN, ~_BIT0, _BIT0);
}

//--------------------------------------------------
// Description  : Disable Highlight Window
// Input Value  : None
// Output Value : None
//--------------------------------------------------
void ScalerQCHighlightWindowOff(void)
{
    ScalerSetDataPortByte(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, 0x00);
    ScalerSetDataPortByte(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, 0x00);
    ScalerSetDataPortByte(P0_60_HLW_ADDR_PORT, _P0_61_PT_0F_HLW_CONTROL2, 0x00);
    ScalerSetDataPortByte(P0_60_HLW_ADDR_PORT, _P0_61_PT_10_HLW_CONTROL3, 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0C_HLW_BORDER_EN, ~_BIT0, 0x00);
}

//--------------------------------------------------
// Description  : Test D-Domain Pattern Generator
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCDPGTest(void)
{
    BYTE ucFlag = 0;
    DebugMessageQC("5. DPG Start", 0x00);
    ScalerQCDDomainPatternGenOn();

    ucFlag = ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tDPG_CRC_TABLE, 1) << 0);

    DebugMessageQC("5. DPG End", 0x00);

    ScalerQCDDomainPatternGenOff();

    if(ucFlag == _TEST_PASS)
    {
        DebugMessageQC("6.DPG PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6.DPG Fail", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : Test D-Domain Random Generator
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCDPGRandomTest(void)
{
    BYTE ucFlag = 0;
    DebugMessageQC("5. D Random PG Start", 0x00);
    ScalerQCDDomainRandomGenOn(_GRAY);

    ucFlag = ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tDPG_RANDOM_CRC_TABLE, 1) << 0);

    ScalerQCDDomainRandomGenOn(_MASS);

    ucFlag = ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tDPG_RANDOM_CRC_TABLE1, 1) << 1);

    DebugMessageQC("5. D Random PG End", 0x00);

    ScalerQCDDomainPatternGenOff();

    if(ucFlag == _TEST_PASS)
    {
        DebugMessageQC("6.D Random PG PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6.D Random PG Fail", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : PCM TEST
// Input Value  : None
// return Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCPCMTest(void)
{
    WORD usData = 0;

    DebugMessageQC("5. PCM Start", 0x00);


    ScalerQCDDomainRandomGenOn(_MASS);

    // 0. R != G != B, setA, Precision = s0.09, NO HLW
    DebugMessageQC("5. Mode_0", 0x00);
    ScalerBurstWrite(tPCM_TEST_SETA, sizeof(tPCM_TEST_SETA), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT6|_BIT5);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tPCM_CRC_MODE0, 1) << 0);

    // 1. R != G != B, setB, Precision = s0.09, NO HLW
    DebugMessageQC("5. Mode_1", 0x00);
    ScalerBurstWrite(tPCM_TEST_SETB, sizeof(tPCM_TEST_SETB), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT6|_BIT5);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tPCM_CRC_MODE1, 1) << 1);

    // 2. R != G != B, setC, Precision = s2.7, NO HLW
    DebugMessageQC("5. Mode_2", 0x00);
    ScalerBurstWrite(tPCM_TEST_SETC, sizeof(tPCM_TEST_SETC), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT6);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tPCM_CRC_MODE2, 1) << 2);

    ScalerQCHighlightWindowOn();

    // 3. R != G != B, setC, Precision = s0.09, sRGB HLW in/out, Gamma HLW in/out
    DebugMessageQC("5. Mode_3", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT7|_BIT6), 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT5|_BIT4), 0x00);
    ScalerBurstWrite(tPCM_TEST_SETA, sizeof(tPCM_TEST_SETA), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT6|_BIT5);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tPCM_CRC_MODE3, 1) << 3);

    // 4. R != G != B, setC, Precision = s0.09, sRGB HLW in/out, Gamma HLW inside
    DebugMessageQC("5. Mode_4", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT7|_BIT6), 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT5|_BIT4), _BIT4);
    ScalerBurstWrite(tPCM_TEST_SETB, sizeof(tPCM_TEST_SETB), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT6|_BIT5);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tPCM_CRC_MODE4, 1) << 4);

    // 5. R != G != B, setC, Precision = s0.09, sRGB HLW inside, Gamma HLW outside
    DebugMessageQC("5. Mode_5", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT7|_BIT6), _BIT6);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT5|_BIT4), _BIT5);
    ScalerBurstWrite(tPCM_TEST_SETA, sizeof(tPCM_TEST_SETA), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT6|_BIT5);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tPCM_CRC_MODE5, 1) << 5);

    // 6. R != G != B, setC, Precision = s0.09, sRGB HLW inside, Gamma HLW in/out
    DebugMessageQC("5. Mode_6", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT7|_BIT6), _BIT6);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT5|_BIT4), 0x00);
    ScalerBurstWrite(tPCM_TEST_SETB, sizeof(tPCM_TEST_SETB), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT6|_BIT5);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tPCM_CRC_MODE6, 1) << 6);

    // 7. R != G != B, setC, Precision = s0.09, sRGB HLW outside, Gamma HLW inside
    DebugMessageQC("5. Mode_7", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT7|_BIT6), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT5|_BIT4), _BIT4);
    ScalerBurstWrite(tPCM_TEST_SETA, sizeof(tPCM_TEST_SETA), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT6|_BIT5);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tPCM_CRC_MODE7, 1) << 7);

    // 8. R != G != B, setC, Precision = s0.09, sRGB HLW outside, Gamma HLW outside
    DebugMessageQC("5. Mode_8", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT7|_BIT6), _BIT7);
    //ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT5|_BIT4), _BIT5);
    ScalerBurstWrite(tPCM_TEST_SETB, sizeof(tPCM_TEST_SETB), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT6|_BIT5);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tPCM_CRC_MODE8, 1) << 8);

    ScalerQCHighlightWindowOff();
    ScalerQCDDomainPatternGenOff();
    ScalerQCPCMOff();

    DebugMessageQC("5. PCM End", 0x00);
    if(usData == 0x00)
    {
        DebugMessageQC("6. PCM PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", usData);
        DebugMessageQC("6. PCM FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : PCM off
// Input Value  : None
// Output Value : None
//--------------------------------------------------
void ScalerQCPCMOff(void)
{
    ScalerSetBit(P9_A1_INPUT_GAMMA_CTRL, ~_BIT6, 0x00);
    ScalerSetBit(P0_62_SRGB_CTRL, ~_BIT2, 0x00);
    ScalerSetBit(P0_67_GAMMA_CTRL_SETA, ~_BIT6, 0x00);
}

//--------------------------------------------------
// Description  : sRGB off
// Input Value  : None
// Output Value : None
//--------------------------------------------------
void ScalerQCsRGBOff(void)
{
    ScalerSetBit(P0_62_SRGB_CTRL, ~_BIT2, 0x00);
}

//--------------------------------------------------
// Description  : sRGB Matrix Test
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCsRGBTest(void)
{
    WORD usData = 0;

    DebugMessageQC("5. sRGB Start", 0x00);
    ScalerQCDDomainRandomGenOn(_MASS);

    // 0. R != G != B, setB, Precision = s0.09, NO HLW
    DebugMessageQC("5. Mode_0", 0x00);
    ScalerBurstWrite(tSRGB_TEST_SETB, sizeof(tSRGB_TEST_SETB), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT6|_BIT5);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tSRGB_CRC_MODE0, 1) << 0);

    // 1. R != G != B, setC, Precision = s2.7, NO HLW
    DebugMessageQC("5. Mode_1", 0x00);
    ScalerBurstWrite(tSRGB_TEST_SETC, sizeof(tSRGB_TEST_SETC), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT6);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tSRGB_CRC_MODE1, 1) << 1);

    ScalerQCHighlightWindowOn();

    // 2. R != G != B, setB, Precision = s0.9, sRGB HLW in/out
    DebugMessageQC("5. Mode_2", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT7|_BIT6), 0x00);
    ScalerBurstWrite(tSRGB_TEST_SETB, sizeof(tSRGB_TEST_SETB), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), 0x00);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tSRGB_CRC_MODE2, 1) << 2);

    // 3. R != G != B, setB, Precision = s1.8, sRGB HLW outside
    DebugMessageQC("5. Mode_3", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT7|_BIT6), _BIT7);
    ScalerBurstWrite(tSRGB_TEST_SETB, sizeof(tSRGB_TEST_SETB), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT5);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tSRGB_CRC_MODE3, 1) << 3);

    // 4. R != G != B, setA, Precision = s0.09, offset setA, sRGB HLW inside
    DebugMessageQC("5. Mode_4", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT7|_BIT6), _BIT6);
    ScalerBurstWrite(tSRGB_TEST_SETA, sizeof(tSRGB_TEST_SETA), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerSetBit(P0_68_GAMMA_BIST_DITHER_SETA, ~(_BIT6|_BIT5), _BIT6|_BIT5);
    usData = usData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tSRGB_CRC_MODE4, 1) << 4);

    ScalerQCHighlightWindowOff();
    ScalerQCDDomainPatternGenOff();
    ScalerQCsRGBOff();

    DebugMessageQC("5. sRGB End", 0x00);

    if(usData == 0x00)
    {
        DebugMessageQC("6. sRGB PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", usData);
        DebugMessageQC("6. sRGB FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : output gamma off
// Input Value  : None
// Output Value : None
//--------------------------------------------------
void ScalerQCGammaOff(void)
{
    ScalerSetBit(P0_67_GAMMA_CTRL_SETA, ~_BIT6, 0x00);
}

//--------------------------------------------------
// Description  : OutputGamma Test
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCGammaTest(void)
{
    BYTE ucData = 0;

    DebugMessageQC("5. Output Gamma Start", 0x00);
    ScalerQCDDomainRandomGenOn(_MASS);

    // 0. R != G != B, LUT setD, NO HLW
    DebugMessageQC("5. Mode_0", 0x00);
    ScalerBurstWrite(tOG_TEST_SETD, sizeof(tOG_TEST_SETD), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tOG_CRC_MODE0, 1) << 0);

    // 1. R != G != B, LUT setB, NO HLW
    DebugMessageQC("5. Mode_1", 0x00);
    ScalerBurstWrite(tOG_TEST_SETB, sizeof(tOG_TEST_SETB), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tOG_CRC_MODE1, 1) << 1);

    // 2. R != G != B, LUT setC, NO HLW
    DebugMessageQC("5. Mode_2", 0x00);
    ScalerBurstWrite(tOG_TEST_SETC, sizeof(tOG_TEST_SETC), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tOG_CRC_MODE2, 1) << 2);

    ScalerQCHighlightWindowOn();

    // 3. R != G != B, LUT setA, Gamma HLW In/Out
    DebugMessageQC("5. Mode_3", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT5|_BIT4), 0x00);
    ScalerBurstWrite(tOG_TEST_SETA, sizeof(tOG_TEST_SETA), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tOG_CRC_MODE3, 1) << 3);

    // 4. R != G != B, LUT setA, Gamma HLW Inside
    DebugMessageQC("5. Mode_4", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT5|_BIT4), _BIT4);
    ScalerBurstWrite(tOG_TEST_SETA, sizeof(tOG_TEST_SETA), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tOG_CRC_MODE4, 1) <<4);

    // 5. R != G != B, LUT setA, Gamma HLW Outside
    DebugMessageQC("5. Mode_5", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT5|_BIT4), _BIT5);
    ScalerBurstWrite(tOG_TEST_SETA, sizeof(tOG_TEST_SETA), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tOG_CRC_MODE5, 1) <<5);

    ScalerQCHighlightWindowOff();
    ScalerQCDDomainPatternGenOff();
    ScalerQCGammaOff();

    DebugMessageQC("5. Output Gamma End", 0x00);

    if(ucData == 0x00)
    {
        DebugMessageQC("6. Output Gamma PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucData);
        DebugMessageQC("6. Output Gamma FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : OutputGamma Test
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCBackGroundColor(void)
{
    BYTE ucData = 0;

    DebugMessageQC("5. BackGround Color Start", 0x00);
    ScalerQCDDomainRandomGenOn(_MASS);
    ScalerSetBit(P0_6C_OVERLAY_CTRL, ~_BIT5, 0x00);
    ScalerSetBit(P0_6C_OVERLAY_CTRL, ~_BIT5, _BIT5);

    ScalerSetByte(P0_6D_BG_COLOR_DATA_PORT_M1, 0x31);
    ScalerSetByte(P0_6D_BG_COLOR_DATA_PORT_M1, 0xAC);
    ScalerSetByte(P0_6D_BG_COLOR_DATA_PORT_M1, 0x7f);
    ScalerSetBit(P0_28_VIDEO_DISPLAY_CONTROL_REG, ~_BIT5, _BIT5);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    ucData = (ucData | (BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tBACKGROUND_COLOR_CRC, 1) << 0);
    ScalerSetBit(P0_6C_OVERLAY_CTRL, ~_BIT5, 0x00);
    ScalerSetBit(P0_28_VIDEO_DISPLAY_CONTROL_REG, ~_BIT5, 0x00);
    DebugMessageQC("5. BackGround Color End", 0x00);

    if(ucData == 0x00)
    {
        DebugMessageQC("6. BackGround Color PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucData);
        DebugMessageQC("6. BackGround Color FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : Disable D Domain Pattern Generator
// Input Value  : None
// Output Value : None
//--------------------------------------------------
void ScalerQCDDomainPatternGenOff(void)
{
    ScalerSetBit(P7_F0_DISP_PG_R_CTRL, ~_BIT7, 0x00);
}

//--------------------------------------------------
// Description  : Enable D Domain Random PG With 10-bit Setting
// Input Value  : None
// Output Value : None
//--------------------------------------------------
void ScalerQCDDomainRandomGenOn(bit bRandomSelect)
{
    // Set initial Value
    ScalerSetBit(P7_F0_DISP_PG_R_CTRL, ~_BIT6, _BIT6);
    ScalerSetByte(P7_F3_DISP_PG_R_INITIAL, 0x00);
    ScalerSetByte(P7_F4_DISP_PG_G_INITIAL, 0x00);
    ScalerSetByte(P7_F5_DISP_PG_B_INITIAL, 0x00);
    ScalerSetByte(P7_FC_D_PG_INITIAL_M_STEP_L, 0x15);
    ScalerSetByte(P7_FD_D_PG_INITIAL_L_CTRL, 0x00);
    ScalerSetByte(P7_FF_D_PATTERN_RESET, 0x00);


    if(bRandomSelect == _GRAY)
    {
        ScalerSetByte(P7_FB_D_PG_CTRL_0, 0x00);    // R=G=B
    }
    else
    {
        ScalerSetByte(P7_FB_D_PG_CTRL_0, 0x40);    // R!=G!=B
    }

    ScalerSetBit(P7_F0_DISP_PG_R_CTRL, ~_BIT7, _BIT7); // Enable
}

//--------------------------------------------------
// Description  : Enable D Domain Pattern Generator With 10-bit Setting
// Input Value  : None
// Output Value : None
//--------------------------------------------------
void ScalerQCDDomainPatternGenOn(void)
{
    // Main Setting
    ScalerSetByte(P7_F0_DISP_PG_R_CTRL, 0x0D);
    ScalerSetByte(P7_F1_DISP_PG_G_CTRL, 0x0D);
    ScalerSetByte(P7_F2_DISP_PG_B_CTRL, 0x0D);
    ScalerSetByte(P7_F3_DISP_PG_R_INITIAL, 0x30);
    ScalerSetByte(P7_F4_DISP_PG_G_INITIAL, 0x60);
    ScalerSetByte(P7_F5_DISP_PG_B_INITIAL, 0x90);
    ScalerSetByte(P7_F6_DISP_PG_PIXEL_DELTA_H, 0x09);
    ScalerSetByte(P7_F7_DISP_PG_LINE_DELTA_H, 0x13);
    ScalerSetByte(P7_F8_DISP_PG_PIXEL_STEP_H, 0x01);
    ScalerSetByte(P7_F9_DISP_PG_LINE_STEP_H, 0x10);
    ScalerSetByte(P7_FA_DISP_PG_DELTA_H_STEP_M, 0x00);
    ScalerSetByte(P7_FB_D_PG_CTRL_0, 0x00);
    ScalerSetByte(P7_FC_D_PG_INITIAL_M_STEP_L, 0x00);
    ScalerSetByte(P7_FD_D_PG_INITIAL_L_CTRL, 0x00);
    ScalerSetByte(P7_FF_D_PATTERN_RESET, 0x00);

    ScalerSetBit(P7_F0_DISP_PG_R_CTRL, ~_BIT7, _BIT7);
}
//--------------------------------------------------
// Description  : DCR Test
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCDCRTest(void)
{
    BYTE ucData = 0;
    BYTE pData[40] = {0};
    BYTE ucCnt = 0;
    BYTE ucTimeOut = 0;

    // Open DCC
    ScalerBurstWrite(tQC_DCC_SETTING0, sizeof(tQC_DCC_SETTING0), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);

    DebugMessageQC("5. DCR Start", 0x00);
    ScalerQCDDomainRandomGenOn(_MASS);

    DebugMessageQC("5. Mode_0", 0x00);
    ScalerQCHighlightWindowOff();
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4 | _BIT3 | _BIT2), (_P7_D9_PT_00_DCR_THESHOLD1_1 << 2));
    ScalerSetByte(P7_D9_DCR_DATA_PORT, 0x08);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4 | _BIT3 | _BIT2), (_P7_D9_PT_01_DCR_THESHOLD2_1 << 2));
    ScalerSetByte(P7_D9_DCR_DATA_PORT, 0x60);

    ScalerSetBit(P7_DA_DCR_CTRL, ~(_BIT3 | _BIT2 | _BIT1 | _BIT0), (_MEASURE_AVERAGE << 1) | _DCR_BEFORE_DCC);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT1 | _BIT0), _BIT0);

    for(ucCnt = 0; ucCnt < 2; ucCnt++)
    {
        ScalerSetBit(P7_DA_DCR_CTRL, ~(_BIT4), _BIT4);
        ucTimeOut = 25;

        while(ucTimeOut--)
        {
            ScalerTimerDelayXms(2);

            if(ScalerGetBit(P7_DA_DCR_CTRL, _BIT4) == _BIT4)
            {
                break;
            }
        }
    }

    ScalerSetByte(P7_D8_DCR_ADDRESS_PORT, 0x0B);
    ScalerRead(P7_D9_DCR_DATA_PORT, 40, pData, _NON_AUTOINC);

    for(ucCnt = 0; ucCnt < 40; ucCnt++)
    {
        if(pData[ucCnt] != tQC_D_DOMAIN_DCR_RESULT_TABLE_0[ucCnt])
        {
            break;
        }
    }

    if(ucCnt < 40)
    {
        ucData= ucData | _BIT0;
        DebugMessageQC("5. ===Fail===",0x00);
    }
    else
    {
        DebugMessageQC("5. ===Pass===",0x00);
    }

    // Pattern 1
    DebugMessageQC("5. Mode_1", 0x00);
    ScalerQCHighlightWindowOn();

    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT5 | _BIT4), 0x00);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4 | _BIT3 | _BIT2), (_P7_D9_PT_00_DCR_THESHOLD1_1 << 2));
    ScalerSetByte(P7_D9_DCR_DATA_PORT, 0x11);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4 | _BIT3 | _BIT2), (_P7_D9_PT_01_DCR_THESHOLD2_1 << 2));
    ScalerSetByte(P7_D9_DCR_DATA_PORT, 0x91);

    ScalerSetBit(P7_DA_DCR_CTRL, ~(_BIT3 | _BIT2 | _BIT1 | _BIT0), (_MEASURE_R << 1) | _DCR_BEFORE_DCC);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT1 | _BIT0), _BIT0);

    for(ucCnt = 0; ucCnt < 2; ucCnt++)
    {
        ScalerSetBit(P7_DA_DCR_CTRL, ~(_BIT4), _BIT4);
        ucTimeOut = 25;

        while(ucTimeOut--)
        {
            ScalerTimerDelayXms(2);

            if(ScalerGetBit(P7_DA_DCR_CTRL, _BIT4) == _BIT4)
            {
                break;
            }
        }
    }

    ScalerSetByte(P7_D8_DCR_ADDRESS_PORT , 0x0B);
    ScalerRead(P7_D9_DCR_DATA_PORT, 40, pData, _NON_AUTOINC);

    for(ucCnt = 0; ucCnt < 40; ucCnt++)
    {
        if(pData[ucCnt] != tQC_D_DOMAIN_DCR_RESULT_TABLE_1[ucCnt])
        {
            break;
        }
    }

    if(ucCnt < 40)
    {
        ucData= ucData | _BIT1;
        DebugMessageQC("5. ===Fail===",0x00);
    }
    else
    {
        DebugMessageQC("5. ===Pass===",0x00);
    }

    // Pattern 2
    DebugMessageQC("5. Mode_2", 0x00);
    ScalerQCHighlightWindowOn();
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT5 | _BIT4), _BIT4);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4 | _BIT3 | _BIT2), (_P7_D9_PT_00_DCR_THESHOLD1_1 << 2));
    ScalerSetByte(P7_D9_DCR_DATA_PORT, 0xEE);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4 | _BIT3 | _BIT2), (_P7_D9_PT_01_DCR_THESHOLD2_1 << 2));
    ScalerSetByte(P7_D9_DCR_DATA_PORT, 0x6E);

    ScalerSetBit(P7_DA_DCR_CTRL, ~(_BIT3 | _BIT2 | _BIT1 | _BIT0), (_MEASURE_G << 1) | _DCR_BEFORE_DCC);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT1 | _BIT0), _BIT0);

    for(ucCnt = 0; ucCnt < 2; ucCnt++)
    {
        ScalerSetBit(P7_DA_DCR_CTRL, ~(_BIT4), _BIT4);
        ucTimeOut = 25;

        while(ucTimeOut--)
        {
            ScalerTimerDelayXms(2);

            if(ScalerGetBit(P7_DA_DCR_CTRL, _BIT4) == _BIT4)
            {
                break;
            }
        }
    }

    ScalerSetByte(P7_D8_DCR_ADDRESS_PORT , 0x0B);
    ScalerRead(P7_D9_DCR_DATA_PORT, 40, pData, _NON_AUTOINC);

    for(ucCnt = 0; ucCnt < 40; ucCnt++)
    {
        if(pData[ucCnt] != tQC_D_DOMAIN_DCR_RESULT_TABLE_2[ucCnt])
        {
            break;
        }
    }

    if(ucCnt < 40)
    {
        ucData= ucData | _BIT2;
        DebugMessageQC("5. ===Fail===",0x00);
    }
    else
    {
        DebugMessageQC("5. ===Pass===",0x00);
    }

    // Pattern 3
    DebugMessageQC("5. Mode_3", 0x00);
    ScalerQCHighlightWindowOn();
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT5 | _BIT4), _BIT5);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4 | _BIT3 | _BIT2), (_P7_D9_PT_00_DCR_THESHOLD1_1 << 2));
    ScalerSetByte(P7_D9_DCR_DATA_PORT, 0x00);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4 | _BIT3 | _BIT2), (_P7_D9_PT_01_DCR_THESHOLD2_1 << 2));
    ScalerSetByte(P7_D9_DCR_DATA_PORT, 0xFF);

    ScalerSetBit(P7_DA_DCR_CTRL, ~(_BIT3 | _BIT2 | _BIT1 | _BIT0), (_MEASURE_B << 1) | _DCR_BEFORE_DCC);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT1 | _BIT0), _BIT0);

    for(ucCnt = 0; ucCnt < 2; ucCnt++)
    {
        ScalerSetBit(P7_DA_DCR_CTRL, ~(_BIT4), _BIT4);
        ucTimeOut = 25;

        while(ucTimeOut--)
        {
            ScalerTimerDelayXms(2);

            if(ScalerGetBit(P7_DA_DCR_CTRL, _BIT4) == _BIT4)
            {
                break;
            }
        }
    }

    ScalerSetByte(P7_D8_DCR_ADDRESS_PORT , 0x0B);
    ScalerRead(P7_D9_DCR_DATA_PORT, 40, pData, _NON_AUTOINC);


    for(ucCnt = 0; ucCnt < 40; ucCnt++)
    {
        if(pData[ucCnt] != tQC_D_DOMAIN_DCR_RESULT_TABLE_3[ucCnt])
        {
            break;
        }
    }

    if(ucCnt < 40)
    {
        ucData= ucData | _BIT3;
        DebugMessageQC("5. ===Fail===",0x00);
    }
    else
    {
        DebugMessageQC("5. ===Pass===",0x00);
    }

    // Pattern 4
    DebugMessageQC("5. Mode_4", 0x00);
    ScalerQCHighlightWindowOn();
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0D_HLW_CONTROL1, ~(_BIT5 | _BIT4), _BIT4);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4 | _BIT3 | _BIT2), (_P7_D9_PT_00_DCR_THESHOLD1_1 << 2));
    ScalerSetByte(P7_D9_DCR_DATA_PORT, 0x27);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT7 | _BIT6 | _BIT5 | _BIT4 | _BIT3 | _BIT2), (_P7_D9_PT_01_DCR_THESHOLD2_1 << 2));
    ScalerSetByte(P7_D9_DCR_DATA_PORT, 0x36);

    ScalerSetBit(P7_DA_DCR_CTRL, ~(_BIT3 | _BIT2 | _BIT1 | _BIT0), (_MEASURE_Y << 1) | _BIT0);
    ScalerSetBit(P7_D8_DCR_ADDRESS_PORT, ~(_BIT1 | _BIT0), _BIT0);

    for(ucCnt = 0; ucCnt < 2; ucCnt++)
    {
        ScalerSetBit(P7_DA_DCR_CTRL, ~(_BIT4), _BIT4);
        ucTimeOut = 25;

        while(ucTimeOut--)
        {
            ScalerTimerDelayXms(2);

            if(ScalerGetBit(P7_DA_DCR_CTRL, _BIT4) == _BIT4)
            {
                break;
            }
        }
    }

    ScalerSetByte(P7_D8_DCR_ADDRESS_PORT , 0x0B);
    ScalerRead(P7_D9_DCR_DATA_PORT, 40, pData, _NON_AUTOINC);

    for(ucCnt = 0; ucCnt < 40; ucCnt++)
    {
        if(pData[ucCnt] != tQC_D_DOMAIN_DCR_RESULT_TABLE_4[ucCnt])
        {
            break;
        }
    }

    if(ucCnt < 40)
    {
        ucData= ucData | _BIT4;
        DebugMessageQC("5. ===Fail===",0x00);
    }
    else
    {
        DebugMessageQC("5. ===Pass===",0x00);
    }

    ScalerSetBit(P7_C7_DCC_CTRL_0, ~_BIT7, 0x00);
    ScalerSetByte(P7_D8_DCR_ADDRESS_PORT , 0x00);                   // Disable DCR Messure
    ScalerSetByte(P0_60_HLW_ADDR_PORT , _P0_61_PT_0D_HLW_CONTROL1);
    ScalerSetBit(P0_61_HLW_DATA_PORT , ~(_BIT5 | _BIT4), 0x00);
    ScalerQCDDomainPatternGenOff();
    ScalerQCHighlightWindowOff();

    DebugMessageQC("5. DCR End", 0x00);

    if(ucData == 0x00)
    {
        DebugMessageQC("6. DCR PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucData);
        DebugMessageQC("6. DCR FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : DCC Test
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCDCCTest(void)
{
    WORD usData = 0;

    DebugMessageQC("5. DCC Start", 0x00);
    ScalerQCDDomainRandomGenOn(_MASS);
    ScalerDDomainBackgroundEnable(_DISABLE);

    // DCC Mode0, HLW OFF
    ScalerBurstWrite(tQC_DCC_SETTING0, sizeof(tQC_DCC_SETTING0), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_0", 0x00);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_DCC_CRC_TABLE0, 1) << 0));

    // DCC Mode1, Inside HLW
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT3 | _BIT2), _BIT2);
    ScalerBurstWrite(tQC_DCC_SETTING1, sizeof(tQC_DCC_SETTING1), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_1", 0x00);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_DCC_CRC_TABLE1, 1) << 1));

    // DCC Mode2, Inside HLW
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT3 | _BIT2), _BIT2);
    ScalerBurstWrite(tQC_DCC_SETTING2, sizeof(tQC_DCC_SETTING2), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_2", 0x00);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_DCC_CRC_TABLE2, 1) << 2));

    // DCC Mode3, Outside HLW
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT3 | _BIT2), _BIT3);
    ScalerBurstWrite(tQC_DCC_SETTING3, sizeof(tQC_DCC_SETTING3), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_3", 0x00);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_DCC_CRC_TABLE3, 1) << 3));

    // DCC Mode4, Outside HLW
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT3 | _BIT2), _BIT3);
    ScalerBurstWrite(tQC_DCC_SETTING4, sizeof(tQC_DCC_SETTING4), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_4", 0x00);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_DCC_CRC_TABLE4, 1) << 4));

    // DCC Mode5, Full
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT3 | _BIT2), 0x00);
    ScalerBurstWrite(tQC_DCC_SETTING5, sizeof(tQC_DCC_SETTING5), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_5", 0x00);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_DCC_CRC_TABLE5, 1) << 6));

    // DCC Mode6, Full
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT3 | _BIT2), 0x00);
    ScalerBurstWrite(tQC_DCC_SETTING6, sizeof(tQC_DCC_SETTING6), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_6", 0x00);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_DCC_CRC_TABLE6, 1) << 7));

    // DCC Mode7, Bypass
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT3 | _BIT2), _BIT3 | _BIT2);
    ScalerBurstWrite(tQC_DCC_SETTING7, sizeof(tQC_DCC_SETTING7), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_7", 0x00);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_DCC_CRC_TABLE7, 1) << 7));

    // Disable Functions
    ScalerSetBit(P7_C7_DCC_CTRL_0, ~_BIT7, 0x00);
    ScalerQCDDomainPatternGenOff();
    ScalerQCHighlightWindowOff();

    // Check Result
    DebugMessageQC("5. DCC End", 0x00);

    if(usData == 0x00)
    {
        DebugMessageQC("6. DCC PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", usData);
        DebugMessageQC("6. DCC FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : ICM Test
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCICMTest(void)
{
    WORD usData = 0;

    DebugMessageQC("5. ICM Start", 0x00);
    ScalerQCDDomainRandomGenOn(_MASS);
    ScalerDDomainBackgroundEnable(_DISABLE);

    // ICM Mode0, HLW OFF
    ScalerBurstWrite(tQC_ICM_SETTING0, sizeof(tQC_ICM_SETTING0), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_0", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_ICM_CRC_TABLE0, 1) << 0));


    // ICM Mode1, HLW OFF
    ScalerBurstWrite(tQC_ICM_SETTING1, sizeof(tQC_ICM_SETTING1), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_1", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_ICM_CRC_TABLE1, 1) << 1));

    // ICM Mode2, HLW Inside
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0F_HLW_CONTROL2, ~(_BIT1 | _BIT0), _BIT0);
    ScalerBurstWrite(tQC_ICM_SETTING2, sizeof(tQC_ICM_SETTING2), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_2", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_ICM_CRC_TABLE2, 1) << 2));

    // ICM Mode3, HLW Inside
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0F_HLW_CONTROL2, ~(_BIT1 | _BIT0), _BIT0);
    ScalerBurstWrite(tQC_ICM_SETTING3, sizeof(tQC_ICM_SETTING3), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_3", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_ICM_CRC_TABLE3, 1) << 3));

    // ICM Mode4, HLW Inside
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0F_HLW_CONTROL2, ~(_BIT1 | _BIT0), _BIT0);
    ScalerBurstWrite(tQC_ICM_SETTING4, sizeof(tQC_ICM_SETTING4), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_4", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_ICM_CRC_TABLE4, 1) << 4));

    // ICM Mode5, HLW Outside
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0F_HLW_CONTROL2, ~(_BIT1 | _BIT0), _BIT1);
    ScalerBurstWrite(tQC_ICM_SETTING5, sizeof(tQC_ICM_SETTING5), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_5", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_ICM_CRC_TABLE5, 1) << 5));

    // ICM Mode6, HLW Outside
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0F_HLW_CONTROL2, ~(_BIT1 | _BIT0), _BIT1);
    ScalerBurstWrite(tQC_ICM_SETTING6, sizeof(tQC_ICM_SETTING6), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_6", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_ICM_CRC_TABLE6, 1) << 6));


    // ICM Mode7, HLW Outside
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0F_HLW_CONTROL2, ~(_BIT1 | _BIT0), _BIT1);
    ScalerBurstWrite(tQC_ICM_SETTING7, sizeof(tQC_ICM_SETTING7), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_7", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_ICM_CRC_TABLE7, 1) << 7));

    // ICM Mode8, HLW Full
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0F_HLW_CONTROL2, ~(_BIT1 | _BIT0), 0x00);
    ScalerBurstWrite(tQC_ICM_SETTING8, sizeof(tQC_ICM_SETTING8), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_8", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_ICM_CRC_TABLE8, 1) << 8));


    // ICM Mode9, HLW Full
    ScalerQCHighlightWindowOn();
    ScalerSetBit(P0_60_HLW_ADDR_PORT, ~(_BIT7), _BIT7);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0F_HLW_CONTROL2, ~(_BIT1 | _BIT0), 0x00);
    ScalerBurstWrite(tQC_ICM_SETTING9, sizeof(tQC_ICM_SETTING9), GET_CURRENT_BANK_NUMBER(), 0, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    DebugMessageQC("5. Mode_9", 0x00);
    usData = (usData | ((WORD)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_ICM_CRC_TABLE9, 1) << 9));

    // Disable Functions
    ScalerSetBit(P7_D0_ICM_CONTROL, ~(_BIT7), 0x00);
    ScalerQCHighlightWindowOff();
    ScalerQCDDomainPatternGenOff();


    // Check Result
    DebugMessageQC("5. ICM End", 0x00);

    if(usData == 0x00)
    {
        DebugMessageQC("6. ICM PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", usData);
        DebugMessageQC("6. ICM FAIL", 0x00);
        return _TEST_FAIL;
    }

}

//--------------------------------------------------
// Description  : CTS Bri Test
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCCTSBRITest(void)
{
    BYTE ucData = 0;

    DebugMessageQC("5. Cts Bri Start", 0x00);
    ScalerQCDDomainRandomGenOn(_MASS);
    ScalerQCHighlightWindowOff();
    ScalerSetBit(P0_62_SRGB_CTRL, ~(_BIT1 | _BIT0), _BIT1 | _BIT0);

    DebugMessageQC("5. Mode_0", 0x00);
    ScalerSetByte(P0_64_CTS_BRI_PORT_ADD, 0x00);
    ScalerBurstWrite(tQC_CON_BRI_SETTING_0, sizeof(tQC_CON_BRI_SETTING_0), GET_CURRENT_BANK_NUMBER(), P0_65_CTS_BRI_PORT_DATA, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);
    ScalerSetDataPortByte(P0_64_CTS_BRI_PORT_ADD, _P0_65_PT_26_CTS_BRI_SWAP, 0x00);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_CON_BRI_DCRC_TABLE_0, 1) << 0);

    DebugMessageQC("5. Mode_1", 0x00);
    ScalerQCHighlightWindowOn();
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT7 | _BIT6), 0x00);

    ScalerSetByte(P0_64_CTS_BRI_PORT_ADD, 0x00);
    ScalerBurstWrite(tQC_CON_BRI_SETTING_1, sizeof(tQC_CON_BRI_SETTING_1), GET_CURRENT_BANK_NUMBER(), P0_65_CTS_BRI_PORT_DATA, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);
    ScalerSetDataPortByte(P0_64_CTS_BRI_PORT_ADD, _P0_65_PT_26_CTS_BRI_SWAP, 0x80);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_CON_BRI_DCRC_TABLE_1, 1) << 1);

    DebugMessageQC("5. Mode_2", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT7 | _BIT6), _BIT7);

    ScalerSetByte(P0_64_CTS_BRI_PORT_ADD, 0x00);
    ScalerBurstWrite(tQC_CON_BRI_SETTING_2, sizeof(tQC_CON_BRI_SETTING_2), GET_CURRENT_BANK_NUMBER(), P0_65_CTS_BRI_PORT_DATA, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);
    ScalerSetDataPortByte(P0_64_CTS_BRI_PORT_ADD, _P0_65_PT_26_CTS_BRI_SWAP, 0x40);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_CON_BRI_DCRC_TABLE_2, 1) << 2);

    DebugMessageQC("5. Mode_3", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT7 | _BIT6), _BIT6);
    ScalerSetByte(P0_64_CTS_BRI_PORT_ADD, 0x00);
    ScalerBurstWrite(tQC_CON_BRI_SETTING_3, sizeof(tQC_CON_BRI_SETTING_3), GET_CURRENT_BANK_NUMBER(), P0_65_CTS_BRI_PORT_DATA, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);
    ScalerSetDataPortByte(P0_64_CTS_BRI_PORT_ADD, _P0_65_PT_26_CTS_BRI_SWAP, 0xC0);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_CON_BRI_DCRC_TABLE_3, 1) << 2);

    DebugMessageQC("5. Mode_4", 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT7 | _BIT6), _BIT7 | _BIT6);
    ScalerSetByte(P0_64_CTS_BRI_PORT_ADD, 0x00);
    ScalerBurstWrite(tQC_CON_BRI_SETTING_4, sizeof(tQC_CON_BRI_SETTING_4), GET_CURRENT_BANK_NUMBER(), P0_65_CTS_BRI_PORT_DATA, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);
    ScalerSetDataPortByte(P0_64_CTS_BRI_PORT_ADD, _P0_65_PT_26_CTS_BRI_SWAP, 0x40);
    ucData = ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tQC_CON_BRI_DCRC_TABLE_4, 1) << 2);

    ScalerSetBit(P0_62_SRGB_CTRL, ~(_BIT1 | _BIT0), 0x00);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT7 | _BIT6), 0x40);
    ScalerQCDDomainPatternGenOff();
    ScalerQCHighlightWindowOff();
    DebugMessageQC("5. Cts Bri End", 0x00);

    if(ucData == 0x00)
    {
        DebugMessageQC("6. Cts Bri PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucData);
        DebugMessageQC("6. Cts Bri FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : YPeaking Test
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCYPeakingTest(void)
{
    BYTE ucData = 0;

    DebugMessageQC("5. YPeaking Start", 0x00);
    ScalerQCDDomainRandomGenOn(_MASS);

    ScalerSetBit(P7_D6_PEAKING_CORING_ACCESS_PORT_CTL, ~(_BIT7 | _BIT5 | _BIT2 | _BIT1 | _BIT0), _BIT7);
    ScalerSetDataPortByte(P7_D6_PEAKING_CORING_ACCESS_PORT_CTL, (_P7_D7_PT_00_PEAKING_C0 | _BIT7), 0x7E);
    ScalerSetDataPortByte(P7_D6_PEAKING_CORING_ACCESS_PORT_CTL, (_P7_D7_PT_01_PEAKING_C1 | _BIT7), 0xD2);
    ScalerSetDataPortByte(P7_D6_PEAKING_CORING_ACCESS_PORT_CTL, (_P7_D7_PT_02_PEAKING_C2 | _BIT7), 0xC1);
    ScalerSetDataPortByte(P7_D6_PEAKING_CORING_ACCESS_PORT_CTL, (_P7_D7_PT_03_CORING_MIN | _BIT7), 0x1F);
    ScalerSetDataPortByte(P7_D6_PEAKING_CORING_ACCESS_PORT_CTL, (_P7_D7_PT_04_CORING_MAX_POS | _BIT7), 0x25);
    ScalerSetDataPortByte(P7_D6_PEAKING_CORING_ACCESS_PORT_CTL, (_P7_D7_PT_05_CORING_MAX_NEG | _BIT7), 0xE3);

    // Enable YPeaking
    ScalerSetBit(P7_D6_PEAKING_CORING_ACCESS_PORT_CTL, ~_BIT6, _BIT6);

    // RandomGen
    DebugMessageQC("5. Mode_0", 0x00);
    ucData = (ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tYPEAKING_CRC_TABLE0, 1) << 0));

    // RandomGen + HLW(_INSIDE_WINDOW)
    ScalerQCHighlightWindowOn();
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT1 | _BIT0), _BIT0);
    DebugMessageQC("5. Mode_1", 0x00);
    ucData = (ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tYPEAKING_CRC_TABLE1, 1) << 1));

    // RandomGen + HLW(_OUTSIDE_WINDOW)
    ScalerSetBit(P7_D6_PEAKING_CORING_ACCESS_PORT_CTL, ~_BIT5, _BIT5);
    ScalerSetDataPortBit(P0_60_HLW_ADDR_PORT, _P0_61_PT_0E_HLW_CONTROL0, ~(_BIT1 | _BIT0), _BIT1);
    DebugMessageQC("5. Mode_2", 0x00);
    ucData = (ucData | ((BYTE)ScalerQCCRCCompare(_D_CRC_AFTER_DDITHER, tYPEAKING_CRC_TABLE2, 1) << 2));

    // Disable YPeaking
    ScalerSetBit(P7_D6_PEAKING_CORING_ACCESS_PORT_CTL, ~_BIT6, 0x00);
    ScalerQCHighlightWindowOff();
    ScalerQCDDomainPatternGenOff();

    if(ucData == 0x00)
    {
       DebugMessageQC("6.====YPeaking PASS====", 0x00);
       return _TEST_PASS;
    }
    else
    {
       DebugMessageQC("6. Fail Mode", ucData);
       DebugMessageQC("6.====YPeaking Fail====", 0x00);
       return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : Color Conversion Test Test
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCDDomainColorConvTest(void)
{
    BYTE ucResult = _TEST_PASS;

    ////////////////////////////////////////////////////////////////////
    // YCbCr -> RGB                                                   //
    ////////////////////////////////////////////////////////////////////
    DebugMessageQC("5. D-Domain Color Conversion Start", 0x00);

    ScalerQCDDomainRandomGenOn(_MASS);

    //////////////////////////////////////////////////////////////////
    // case 0
    ScalerBurstWrite(tQC_CONV_YUV2RGB_TABLE0, sizeof(tQC_CONV_YUV2RGB_TABLE0), GET_CURRENT_BANK_NUMBER(), P14_A2_SR_YCC2RGB_COEF_K11_MSB, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    ScalerTimerWaitForEvent(_EVENT_DVS);

    DebugMessageQC("5. Color Conv case0", 0x00);
    ucResult = ucResult | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tDCOLORCONV_CRC_TABLE_0, 1) << 0);

    //////////////////////////////////////////////////////////////////
    // case 1
    ScalerBurstWrite(tQC_CONV_YUV2RGB_TABLE1, sizeof(tQC_CONV_YUV2RGB_TABLE1), GET_CURRENT_BANK_NUMBER(), P14_A2_SR_YCC2RGB_COEF_K11_MSB, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    ScalerTimerWaitForEvent(_EVENT_DVS);

    DebugMessageQC("5. Color Conv case1", 0x01);
    ucResult = ucResult | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tDCOLORCONV_CRC_TABLE_1, 1) << 1);

    //////////////////////////////////////////////////////////////////
    // case 2
    ScalerBurstWrite(tQC_CONV_YUV2RGB_TABLE2, sizeof(tQC_CONV_YUV2RGB_TABLE2), GET_CURRENT_BANK_NUMBER(), P14_A2_SR_YCC2RGB_COEF_K11_MSB, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    ScalerTimerWaitForEvent(_EVENT_DVS);

    DebugMessageQC("5. Color Conv case2", 0x02);
    ucResult = ucResult | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tDCOLORCONV_CRC_TABLE_2, 1) << 2);

    //////////////////////////////////////////////////////////////////
    // case 3
    ScalerBurstWrite(tQC_CONV_YUV2RGB_TABLE3, sizeof(tQC_CONV_YUV2RGB_TABLE3), GET_CURRENT_BANK_NUMBER(), P14_A2_SR_YCC2RGB_COEF_K11_MSB, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    ScalerTimerWaitForEvent(_EVENT_DVS);

    DebugMessageQC("5. Color Conv case3", 0x03);
    ucResult = ucResult | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tDCOLORCONV_CRC_TABLE_3, 1) << 3);

    //////////////////////////////////////////////////////////////////
    // case 4
    ScalerBurstWrite(tQC_CONV_YUV2RGB_TABLE4, sizeof(tQC_CONV_YUV2RGB_TABLE4), GET_CURRENT_BANK_NUMBER(), P14_A2_SR_YCC2RGB_COEF_K11_MSB, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    ScalerTimerWaitForEvent(_EVENT_DVS);

    DebugMessageQC("5. Color Conv case4", 0x04);
    ucResult = ucResult | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tDCOLORCONV_CRC_TABLE_4, 1) << 4);

    //////////////////////////////////////////////////////////////////
    // case 5
    ScalerBurstWrite(tQC_CONV_YUV2RGB_TABLE5, sizeof(tQC_CONV_YUV2RGB_TABLE5), GET_CURRENT_BANK_NUMBER(), P14_A2_SR_YCC2RGB_COEF_K11_MSB, _BURSTWRITE_COMMAND, _BURSTWRITE_FROM_FLASH);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    ScalerTimerWaitForEvent(_EVENT_DVS);

    DebugMessageQC("5. Color Conv case5", 0x05);
    ucResult = ucResult | ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tDCOLORCONV_CRC_TABLE_5, 1) << 7);

    ScalerQCDDomainPatternGenOff();

    // Disable YUV2RGB conversion
    ScalerSetBit(P14_A1_SR_YCC2RGB_CTRL, ~_BIT0, 0x00);
    ScalerTimerWaitForEvent(_EVENT_DVS);

    DebugMessageQC("5. D-Domain Color Conversion End", 0x00);

    if(ucResult == 0)
    {
        DebugMessageQC("6. D-Domain Color Conversion PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucResult);
        DebugMessageQC("6. D-Domain Color Conversion FAIL", 0x00);
        return _TEST_FAIL;
    }
}

//--------------------------------------------------
// Description  : DDither Test
// Input Value  : None
// Output Value : _TEST_PASS or _TEST_FAIL
//--------------------------------------------------
bit ScalerQCDDitherTest(void)
{
    BYTE ucData = 0;
    BYTE ucTemp = 0;

    DebugMessageQC("5. D Dither Start", 0x00);

    ScalerQCDDomainRandomGenOn(_MASS);
    // 10->8
    DebugMessageQC("5. Mode_0", 0x00);
    // Load Dither Table
    ScalerSetBit(P0_6A_D_DITHER_COMMON_CTRL1, ~(_BIT7 | _BIT6 | _BIT5), _BIT7);
    ScalerBurstWrite(tQC_D_DOMAIN_DITHER_10_8_TABLE, sizeof(tQC_D_DOMAIN_DITHER_10_8_TABLE), GET_CURRENT_BANK_NUMBER(), P0_69_D_DITHER_DATA_ACCESS, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);

    // Load Seq Table
    ScalerSetBit(P0_6A_D_DITHER_COMMON_CTRL1, ~(_BIT7 | _BIT6), _BIT6);
    ScalerBurstWrite(tQC_D_DOMAIN_DITHER_SEQ_TABLE, sizeof(tQC_D_DOMAIN_DITHER_SEQ_TABLE), GET_CURRENT_BANK_NUMBER(), P0_69_D_DITHER_DATA_ACCESS, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);

    // Load Temporal Table
    ScalerSetBit(P0_6A_D_DITHER_COMMON_CTRL1, ~(_BIT7 | _BIT6), _BIT7 | _BIT6);
    ScalerBurstWrite(tQC_DITHER_TEMOFFSET, sizeof(tQC_DITHER_TEMOFFSET), GET_CURRENT_BANK_NUMBER(), P0_69_D_DITHER_DATA_ACCESS, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);

    ScalerTimerWaitForEvent(_EVENT_DVS);
    ScalerTimerDelayXms(2);
    ScalerSetBit(P0_6A_D_DITHER_COMMON_CTRL1, 0x00, _BIT4);
    ScalerSetByte(P0_6B_D_DITHER_REGISTER_ADDR, _P0_69_PT_00_D_DITHER_COMMON_SET0);
    ScalerSetByte(P0_69_D_DITHER_DATA_ACCESS, 0x00);
    ScalerSetByte(P0_6B_D_DITHER_REGISTER_ADDR, _P0_69_PT_02_D_DITHER_COMMON_SET2);
    ScalerSetByte(P0_69_D_DITHER_DATA_ACCESS, 0x04);
    ScalerSetByte(P0_6B_D_DITHER_REGISTER_ADDR, _P0_69_PT_0D_D_DITHER_COMMON_CTRL2);
    ScalerSetByte(P0_69_D_DITHER_DATA_ACCESS, 0x0A);

    ScalerSetBit(P0_6A_D_DITHER_COMMON_CTRL1, ~_BIT5, _BIT5);

    ucData = ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tQC_DDITHER_CRCTABLE_0, sizeof(tQC_DDITHER_CRCTABLE_0) / 6) << 0);

    DebugMessageQC("5. Mode_1", 0x00);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    ScalerTimerDelayXms(2);
    ScalerSetByte(P0_6A_D_DITHER_COMMON_CTRL1, 0x00);
    ScalerSetByte(P0_6B_D_DITHER_REGISTER_ADDR, _P0_69_PT_00_D_DITHER_COMMON_SET0);
    ScalerSetByte(P0_69_D_DITHER_DATA_ACCESS, 0x20);
    ScalerSetByte(P0_6B_D_DITHER_REGISTER_ADDR, _P0_69_PT_02_D_DITHER_COMMON_SET2);
    ScalerSetByte(P0_69_D_DITHER_DATA_ACCESS, 0x00);
    ScalerSetByte(P0_6B_D_DITHER_REGISTER_ADDR, _P0_69_PT_0D_D_DITHER_COMMON_CTRL2);
    ScalerSetByte(P0_69_D_DITHER_DATA_ACCESS, 0x03);
    ScalerSetBit(P0_6A_D_DITHER_COMMON_CTRL1, ~_BIT5, _BIT5);

    ucData = ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tQC_DDITHER_CRCTABLE_1, sizeof(tQC_DDITHER_CRCTABLE_1) / 6) << 1);

    DebugMessageQC("5. Mode_2", 0x00);
    ScalerTimerWaitForEvent(_EVENT_DVS);
    ScalerTimerDelayXms(2);
    // Load Dither Table
    ScalerSetBit(P0_6A_D_DITHER_COMMON_CTRL1, ~(_BIT7 | _BIT6 | _BIT5), _BIT7);
    ScalerBurstWrite(tQC_D_DOMAIN_DITHER_10_6_TABLE, sizeof(tQC_D_DOMAIN_DITHER_10_6_TABLE), GET_CURRENT_BANK_NUMBER(), P0_69_D_DITHER_DATA_ACCESS, _BURSTWRITE_DATA_COMMON, _BURSTWRITE_FROM_FLASH);
    ScalerSetByte(P0_6A_D_DITHER_COMMON_CTRL1, 0x0F);
    ScalerSetByte(P0_6B_D_DITHER_REGISTER_ADDR, _P0_69_PT_00_D_DITHER_COMMON_SET0);
    ScalerSetByte(P0_69_D_DITHER_DATA_ACCESS, 0x80);
    ScalerSetByte(P0_6B_D_DITHER_REGISTER_ADDR, _P0_69_PT_02_D_DITHER_COMMON_SET2);
    ScalerSetByte(P0_69_D_DITHER_DATA_ACCESS, 0x00);
    ScalerSetByte(P0_6B_D_DITHER_REGISTER_ADDR, _P0_69_PT_0D_D_DITHER_COMMON_CTRL2);
    ScalerSetByte(P0_69_D_DITHER_DATA_ACCESS, 0x00);
    ScalerSetBit(P0_6A_D_DITHER_COMMON_CTRL1, ~_BIT5, _BIT5);
    ucData = ((BYTE)ScalerQCCRCCompare( _D_CRC_AFTER_DDITHER, tQC_DDITHER_CRCTABLE_2, sizeof(tQC_DDITHER_CRCTABLE_2) / 6) << 2);

    ScalerSetByte(P0_6A_D_DITHER_COMMON_CTRL1, 0x00);
    ScalerQCDDomainPatternGenOff();

    DebugMessageQC("5. D Dither End", 0x00);

    if(ucData == 0x00)
    {
        DebugMessageQC("6. D Dither PASS", 0x00);
        return _TEST_PASS;
    }
    else
    {
        DebugMessageQC("6. Fail Mode", ucData);
        DebugMessageQC("6. D Dither FAIL", 0x00);
        return _TEST_FAIL;
    }
}

#endif // End of #if(_FACTORY_RTD_QC_SUPPORT == _ON)
